Index: trunk/phase3/maintenance/tests/phpunit/includes/XmlTest.php |
— | — | @@ -93,6 +93,39 @@ |
94 | 94 | } |
95 | 95 | |
96 | 96 | # |
| 97 | + # input and label |
| 98 | + # |
| 99 | + function testLabelCreation() { |
| 100 | + $this->assertEquals( |
| 101 | + '<label for="id">name</label>', |
| 102 | + Xml::label( 'name', 'id' ), |
| 103 | + 'label() with no attribs' |
| 104 | + ); |
| 105 | + } |
| 106 | + function testLabelAttributeCanOnlyBeClass() { |
| 107 | + $this->assertEquals( |
| 108 | + '<label for="id">name</label>', |
| 109 | + Xml::label( 'name', 'id', array( 'generated' => true ) ), |
| 110 | + 'label() can not be given a generated attribute' |
| 111 | + ); |
| 112 | + $this->assertEquals( |
| 113 | + '<label for="id" class="nice">name</label>', |
| 114 | + Xml::label( 'name', 'id', array( 'class' => 'nice' ) ), |
| 115 | + 'label() can get a class attribute' |
| 116 | + ); |
| 117 | + $this->assertEquals( |
| 118 | + '<label for="id" class="nice">name</label>', |
| 119 | + Xml::label( 'name', 'id', array( |
| 120 | + 'generated' => true, |
| 121 | + 'class' => 'nice', |
| 122 | + 'anotherattr' => 'value', |
| 123 | + ) |
| 124 | + ), |
| 125 | + 'label() skip all attributes but "class"' |
| 126 | + ); |
| 127 | + } |
| 128 | + |
| 129 | + # |
97 | 130 | # JS |
98 | 131 | # |
99 | 132 | function testEscapeJsStringSpecialChars() { |