3 class HTMLPurifier_HTMLModule_FormsTest
extends HTMLPurifier_HTMLModuleHarness
8 $this->config
->set('HTML.Trusted', true);
9 $this->config
->set('Attr.EnableID', true);
10 $this->config
->set('Cache.DefinitionImpl', null);
13 function testBasicUse() {
14 $this->assertResult( // need support for label for later
16 <form action="http://somesite.com/prog/adduser" method="post">
18 <label>First name: </label>
19 <input type="text" id="firstname" /><br />
20 <label>Last name: </label>
21 <input type="text" id="lastname" /><br />
22 <label>email: </label>
23 <input type="text" id="email" /><br />
24 <input type="radio" name="sex" value="Male" /> Male<br />
25 <input type="radio" name="sex" value="Female" /> Female<br />
26 <input type="submit" value="Send" /> <input type="reset" />
32 function testSelectOption() {
34 <form action="http://somesite.com/prog/component-select" method="post">
36 <select multiple="multiple" size="4" name="component-select">
37 <option selected="selected" value="Component_1_a">Component_1</option>
38 <option selected="selected" value="Component_1_b">Component_2</option>
39 <option>Component_3</option>
40 <option>Component_4</option>
41 <option>Component_5</option>
42 <option>Component_6</option>
43 <option>Component_7</option>
45 <input type="submit" value="Send" /><input type="reset" />
51 function testSelectOptgroup() {
53 <form action="http://somesite.com/prog/someprog" method="post">
56 <option selected="selected" label="none" value="none">None</option>
57 <optgroup label="PortMaster 3">
58 <option label="3.7.1" value="pm3_3.7.1">PortMaster 3 with ComOS 3.7.1</option>
59 <option label="3.7" value="pm3_3.7">PortMaster 3 with ComOS 3.7</option>
60 <option label="3.5" value="pm3_3.5">PortMaster 3 with ComOS 3.5</option>
62 <optgroup label="PortMaster 2">
63 <option label="3.7" value="pm2_3.7">PortMaster 2 with ComOS 3.7</option>
64 <option label="3.5" value="pm2_3.5">PortMaster 2 with ComOS 3.5</option>
66 <optgroup label="IRX">
67 <option label="3.7R" value="IRX_3.7R">IRX with ComOS 3.7R</option>
68 <option label="3.5R" value="IRX_3.5R">IRX with ComOS 3.5R</option>
76 function testTextarea() {
78 <form action="http://somesite.com/prog/text-read" method="post">
80 <textarea name="thetext" rows="20" cols="80">
81 First line of initial text.
82 Second line of initial text.
84 <input type="submit" value="Send" /><input type="reset" />
90 // label tests omitted
92 function testFieldset() {
94 <form action="..." method="post">
96 <legend>Personal Information</legend>
97 Last Name: <input name="personal_lastname" type="text" tabindex="1" />
98 First Name: <input name="personal_firstname" type="text" tabindex="2" />
99 Address: <input name="personal_address" type="text" tabindex="3" />
100 ...more personal information...
103 <legend>Medical History</legend>
104 <input name="history_illness" type="checkbox" value="Smallpox" tabindex="20" />Smallpox
105 <input name="history_illness" type="checkbox" value="Mumps" tabindex="21" /> Mumps
106 <input name="history_illness" type="checkbox" value="Dizziness" tabindex="22" /> Dizziness
107 <input name="history_illness" type="checkbox" value="Sneezing" tabindex="23" /> Sneezing
108 ...more medical history...
111 <legend>Current Medication</legend>
112 Are you currently taking any medication?
113 <input name="medication_now" type="radio" value="Yes" tabindex="35" />Yes
114 <input name="medication_now" type="radio" value="No" tabindex="35" />No
116 If you are currently taking medication, please indicate
117 it in the space below:
118 <textarea name="current_medication" rows="20" cols="50" tabindex="40"></textarea>
124 function testInputTransform() {
125 $this->assertResult('<input type="checkbox" />', '<input type="checkbox" value="" />');
128 function testTextareaTransform() {
129 $this->assertResult('<textarea></textarea>', '<textarea cols="22" rows="3"></textarea>');
132 function testTextInFieldset() {
133 $this->assertResult('<fieldset> <legend></legend>foo</fieldset>');
138 // vim: et sw=4 sts=4