From 5ecb11f19aa255bb8a0faa2af64db6d855a99496 Mon Sep 17 00:00:00 2001 From: "Edward Z. Yang" Date: Thu, 21 Jun 2007 00:42:00 +0000 Subject: [PATCH] Tack on missing basic smoketests. git-svn-id: http://htmlpurifier.org/svnroot/htmlpurifier/branches/strict@1180 48356398-32a2-884e-a903-53898d9a118a --- smoketests/basic.php | 70 +++++++++++++++++++++ smoketests/basic/allElements.css | 48 +++++++++++++++ smoketests/basic/allElements.html | 79 ++++++++++++++++++++++++ smoketests/basic/legacy.css | 71 ++++++++++++++++++++++ smoketests/basic/legacy.html | 124 ++++++++++++++++++++++++++++++++++++++ 5 files changed, 392 insertions(+) create mode 100644 smoketests/basic.php create mode 100644 smoketests/basic/allElements.css create mode 100644 smoketests/basic/allElements.html create mode 100644 smoketests/basic/legacy.css create mode 100644 smoketests/basic/legacy.html diff --git a/smoketests/basic.php b/smoketests/basic.php new file mode 100644 index 00000000..7c791be5 --- /dev/null +++ b/smoketests/basic.php @@ -0,0 +1,70 @@ + true, + 'legacy' => true +); + +$page = isset($_GET['p']) ? $_GET['p'] : false; +if (!isset($allowed[$page])) $page = false; + +$strict = isset($_GET['d']) ? (bool) $_GET['d'] : false; + +echo ''; +?> + + + + + + + + HTML Purifier Basic Smoketest + + + + + +
: +Swap
+Valid XHTML 1.0 Transitional +
+set('Attr', 'EnableID', true); + $config->set('HTML', 'Strict', $strict); + $purifier = new HTMLPurifier($config); + echo $purifier->purify(file_get_contents("basic/$page.html")); +} else { + ?> +

HTML Purifier Basic Smoketest Index

+ + + \ No newline at end of file diff --git a/smoketests/basic/allElements.css b/smoketests/basic/allElements.css new file mode 100644 index 00000000..874c094c --- /dev/null +++ b/smoketests/basic/allElements.css @@ -0,0 +1,48 @@ +div > * {background:#F00; color:#FFF; font-weight:bold; padding:0.2em; margin:0.1em;} +#core-attributes #core-attributes-id, +#core-attributes .core-attributes-class, +#core-attributes div[title='tooltip'], +#core-attributes div[lang='en'], +#core-attributes div[onclick="alert('foo');"], +#module-text abbr, +#module-text acronym, +#module-text div blockquote, +#module-text blockquote[cite='http://www.example.com'], +#module-text br, +#module-text cite, +#module-text code, +#module-text dfn, +#module-text em, +#module-text h1, +#module-text h2, +#module-text h3, +#module-text h4, +#module-text h5, +#module-text h6, +#module-text kbd, +#module-text p, +#module-text pre, +#module-text span q, +#module-text q[cite='http://www.example.com'], +#module-text samp, +#module-text strong, +#module-text var, +#module-hypertext span a, +#module-hypertext a[accesskey='q'], +#module-hypertext a[charset='UTF-8'], +#module-hypertext a[href='http://www.example.com/'], +#module-hypertext a[hreflang='en'], +#module-hypertext a[rel='nofollow'], +#module-hypertext a[rev='index'], +#module-hypertext a[tabindex='1'], +#module-hypertext a[type='text/plain'], +#module-list dl, +#module-list ul, +#module-list ol, +#module-list li, +#module-list dd, +#module-list dt, +.insert-declarations-above + {background:#008000; margin:0; padding:0.2em;} +#module-text span, #module-text div {padding:0; margin:0.1em;} +#module-list li, #module-list dd, #module-list dt {border:1px solid #FFF;} \ No newline at end of file diff --git a/smoketests/basic/allElements.html b/smoketests/basic/allElements.html new file mode 100644 index 00000000..a3fa408a --- /dev/null +++ b/smoketests/basic/allElements.html @@ -0,0 +1,79 @@ + + + + + HTML Purifier All Elements Smoketest + + + + + +

HTML Purifier All Elements Smoketest

+ +

This is the all elements smoke +test. It is divided by XHTML 1.1 style modules. Make sure +div, span and id are allowed, +otherwise there will be problems.

+ +

Core attributes

+
+
id
+
class
+
title
+
lang
+
xml:lang (green when lang also present)
+
style
+
onclick (and other event handlers)
+
+ +

Text module

+
+ abbr + acronym +
blockquote
+
blockquote@cite
+
+ cite + code + dfn + em +

h1

+

h2

+

h3

+

h4

+
h5
+
h6
+ kbd +

p

+
pre
+ q + q@cite + samp + strong + var +
+ +

Hypertext module

+
+ a: + accesskey + charset + href + hreflang + rel + rev + tabindex + type +
+ +

List module

+
+
dl dt
dl dd
+
  1. ol li
+ +
+ + + \ No newline at end of file diff --git a/smoketests/basic/legacy.css b/smoketests/basic/legacy.css new file mode 100644 index 00000000..d6d673ac --- /dev/null +++ b/smoketests/basic/legacy.css @@ -0,0 +1,71 @@ + +center, +dir[compact='compact'], +isindex[prompt='Foo'], +menu[compact='compact'], +s, +u, +strike, + +caption[align='bottom'], +div[align='center'], +dl[compact='compact'], + +h1[align='right'], +h2[align='right'], +h3[align='right'], +h4[align='right'], +h5[align='right'], +h6[align='right'], + +hr[align='right'], +hr[noshade='noshade'], +hr[width='50'], +hr[size='50'], + +img[align='right'], +img[border='3'], +img[hspace='5'], +img[vspace='5'], + +input[align='right'], +legend[align='center'], + +li[type='A'], +li[value='5'], + +ol[compact='compact'], +ol[start='3'], +ol[type='I'], + +p[align='right'], + +pre[width='50'], + +table[align='right'], +table[bgcolor='#0000FF'], + +tr[bgcolor='#0000FF'], + +td[bgcolor='#0000FF'], +td[height='50'], +td[nowrap='nowrap'], +td[width='200'], + +th[bgcolor='#0000FF'], +th[height='50'], +th[nowrap='nowrap'], +th[width='200'], + +ul[compact='compact'], +ul[type='square'], + +.insert-declarations-above + {background:#008000; color:#FFF; font-weight:bold;} + +font {background:#BFB;} +u {border:1px solid #000;} +hr {height:1em;} +hr[size='50'] {height:50px;} +img[border='3'] {border: 3px solid #000;} +li[type='a'], li[value='5'] {color:#DDD;} diff --git a/smoketests/basic/legacy.html b/smoketests/basic/legacy.html new file mode 100644 index 00000000..00919734 --- /dev/null +++ b/smoketests/basic/legacy.html @@ -0,0 +1,124 @@ + + + + + HTML Purifier Legacy Smoketest Test Data + + + + + +

HTML Purifier Legacy Smoketest Test Data

+ +

This is the legacy smoketest.

+ +

Elements

+ +
+
+ + basefont: Green, Arial, size 6 text (IE-only) +
+ +
center
+ + +
  • dir
  • +
    + +font: Green, Arial, size 6 text + +isindex: + + + +
  • menu
  • +
    + +s strike u +
    + +

    Attributes

    + +
    + + +
    *
    +
    +

    br@clear (asterisk is up)

    + + + + +
    caption@align
    Cell
    + +
    div@center
    + +
    +
    dl@compact
    +
    + +

    h1

    +

    h2

    +

    h3

    +

    h4

    +
    h5
    +
    h6
    + +hr@align +
    +hr@noshade +
    +hr@width +
    +hr@size +
    + +img@align | +img@border | +img@hspace | +img@vspace + + + +Legend + +
      +
    1. li@type (ensure that it's a capital A)
    2. +
    3. li@value
    4. +
    + +
    1. ol@compact
    +
    1. ol@start
    +
    1. ol@type
    + +

    p@align

    + +
    pre@width
    + + + +
    table@align
    +
    table@bgcolor
    + +
    tr@bgcolor
    + +
    td@bgcolor
    +
    td@height
    +
    td@nowrap
    +
    td@width
    + +
    th@bgcolor
    +
    th@height
    +
    th@nowrap
    +
    th@width
    + + + + +
    + + + \ No newline at end of file -- 2.11.4.GIT