Fix autoparagraph bug with non-inline elements.
[htmlpurifier.git] / tests / HTMLPurifier / AttrTransform / InputTest.php
blob2603ff1beaa386d00b3365e5658f0976f5fc3fec
1 <?php
3 class HTMLPurifier_AttrTransform_InputTest extends HTMLPurifier_AttrTransformHarness
6 function setUp() {
7 parent::setUp();
8 $this->obj = new HTMLPurifier_AttrTransform_Input();
11 function testEmptyInput() {
12 $this->assertResult(array());
15 function testInvalidCheckedWithEmpty() {
16 $this->assertResult(array('checked' => 'checked'), array());
19 function testInvalidCheckedWithPassword() {
20 $this->assertResult(array(
21 'checked' => 'checked',
22 'type' => 'password'
23 ), array(
24 'type' => 'password'
25 ));
28 function testValidCheckedWithUcCheckbox() {
29 $this->assertResult(array(
30 'checked' => 'checked',
31 'type' => 'CHECKBOX',
32 'value' => 'bar',
33 ));
36 function testInvalidMaxlength() {
37 $this->assertResult(array(
38 'maxlength' => '10',
39 'type' => 'checkbox',
40 'value' => 'foo',
41 ), array(
42 'type' => 'checkbox',
43 'value' => 'foo',
44 ));
47 function testValidMaxLength() {
48 $this->assertResult(array(
49 'maxlength' => '10',
50 ));
53 // these two are really bad test-cases
55 function testSizeWithCheckbox() {
56 $this->assertResult(array(
57 'type' => 'checkbox',
58 'value' => 'foo',
59 'size' => '100px',
60 ), array(
61 'type' => 'checkbox',
62 'value' => 'foo',
63 'size' => '100',
64 ));
67 function testSizeWithText() {
68 $this->assertResult(array(
69 'type' => 'password',
70 'size' => '100px', // spurious value, to indicate no validation takes place
71 ), array(
72 'type' => 'password',
73 'size' => '100px',
74 ));
77 function testInvalidSrc() {
78 $this->assertResult(array(
79 'src' => 'img.png',
80 ), array());
83 function testMissingValue() {
84 $this->assertResult(array(
85 'type' => 'checkbox',
86 ), array(
87 'type' => 'checkbox',
88 'value' => '',
89 ));
94 // vim: et sw=4 sts=4