mirror of
https://github.com/ezyang/htmlpurifier.git
synced 2024-11-08 06:48:42 +00:00
Add initial allElements smoketest. Incomplete.
git-svn-id: http://htmlpurifier.org/svnroot/htmlpurifier/trunk@1112 48356398-32a2-884e-a903-53898d9a118a
This commit is contained in:
parent
0cb1d85822
commit
f985d3cd96
48
smoketests/allElements.css
Normal file
48
smoketests/allElements.css
Normal file
@ -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;}
|
79
smoketests/allElements.html
Normal file
79
smoketests/allElements.html
Normal file
@ -0,0 +1,79 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE html
|
||||
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-loose.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
||||
<head>
|
||||
<title>HTML Purifier All Elements Smoketest Test Data</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
||||
<link rel="stylesheet" href="allElements.css" type="text/css" />
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<h1>HTML Purifier All Elements Smoketest Test Data</h1>
|
||||
|
||||
<p>This file includes all the test data for the all elements smoke
|
||||
test. It is divided by XHTML 1.1 style modules. Make sure
|
||||
<code>div</code>, <code>span</code> and <code>id</code> are allowed,
|
||||
otherwise there will be problems.</p>
|
||||
|
||||
<h2>Core attributes</h2>
|
||||
<div id="core-attributes">
|
||||
<div id="core-attributes-id">id</div>
|
||||
<div class="core-attributes-class">class</div>
|
||||
<div title="tooltip">title</div>
|
||||
<div lang="en">lang</div>
|
||||
<div xml:lang="en">xml:lang (green when lang also present)</div>
|
||||
<div style="background:#008000">style</div>
|
||||
<div onclick="alert('foo');">onclick (and other event handlers)</div>
|
||||
</div>
|
||||
|
||||
<h2>Text module</h2>
|
||||
<div id="module-text">
|
||||
<abbr>abbr</abbr>
|
||||
<acronym>acronym</acronym>
|
||||
<div><blockquote>blockquote</blockquote></div>
|
||||
<blockquote cite="http://www.example.com">blockquote@cite</blockquote>
|
||||
<br />
|
||||
<cite>cite</cite>
|
||||
<code>code</code>
|
||||
<dfn>dfn</dfn>
|
||||
<em>em</em>
|
||||
<h1>h1</h1>
|
||||
<h2>h2</h2>
|
||||
<h3>h3</h3>
|
||||
<h4>h4</h4>
|
||||
<h5>h5</h5>
|
||||
<h6>h6</h6>
|
||||
<kbd>kbd</kbd>
|
||||
<p>p</p>
|
||||
<pre>pre</pre>
|
||||
<span><q>q</q></span>
|
||||
<q cite="http://www.example.com">q@cite</q>
|
||||
<samp>samp</samp>
|
||||
<strong>strong</strong>
|
||||
<var>var</var>
|
||||
</div>
|
||||
|
||||
<h2>Hypertext module</h2>
|
||||
<div id="module-hypertext">
|
||||
<span><a>a</a></span>:
|
||||
<a accesskey="q">accesskey</a>
|
||||
<a charset="UTF-8">charset</a>
|
||||
<a href="http://www.example.com/">href</a>
|
||||
<a hreflang="en">hreflang</a>
|
||||
<a rel="nofollow">rel</a>
|
||||
<a rev="index">rev</a>
|
||||
<a tabindex="1">tabindex</a>
|
||||
<a type="text/plain">type</a>
|
||||
</div>
|
||||
|
||||
<h2>List module</h2>
|
||||
<div id="module-list">
|
||||
<dl><dt>dl dt</dt><dd>dl dd</dd></dl>
|
||||
<ol><li>ol li</li></ol>
|
||||
<ul><li>ul li</li></ul>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
28
smoketests/allElements.php
Normal file
28
smoketests/allElements.php
Normal file
@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
require_once 'common.php';
|
||||
|
||||
// todo : modularize the HTML in to separate files
|
||||
|
||||
echo '<?xml version="1.0" encoding="UTF-8" ?>';
|
||||
?><!DOCTYPE html
|
||||
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<title>HTML Purifier UTF-8 Smoketest</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
||||
<link rel="stylesheet" href="allElements.css" type="text/css" />
|
||||
</head>
|
||||
<body>
|
||||
<?php
|
||||
|
||||
$config = HTMLPurifier_Config::createDefault();
|
||||
$config->set('Attr', 'EnableID', true);
|
||||
|
||||
$purifier = new HTMLPurifier($config);
|
||||
echo $purifier->purify(file_get_contents('allElements.html'));
|
||||
|
||||
?>
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in New Issue
Block a user