http://www.mediawiki.org/wiki/Special:Code/MediaWiki/76238
Revision: 76238
Author: hashar
Date: 2010-11-07 10:06:22 +0000 (Sun, 07 Nov 2010)
Log Message:
-----------
Xml::label() tests. Follow up r63675.
Modified Paths:
--------------
trunk/phase3/maintenance/tests/phpunit/includes/XmlTest.php
Modified: trunk/phase3/maintenance/tests/phpunit/includes/XmlTest.php
===================================================================
--- trunk/phase3/maintenance/tests/phpunit/includes/XmlTest.php 2010-11-07
09:44:36 UTC (rev 76237)
+++ trunk/phase3/maintenance/tests/phpunit/includes/XmlTest.php 2010-11-07
10:06:22 UTC (rev 76238)
@@ -93,6 +93,39 @@
}
#
+ # input and label
+ #
+ function testLabelCreation() {
+ $this->assertEquals(
+ '<label for="id">name</label>',
+ Xml::label( 'name', 'id' ),
+ 'label() with no attribs'
+ );
+ }
+ function testLabelAttributeCanOnlyBeClass() {
+ $this->assertEquals(
+ '<label for="id">name</label>',
+ Xml::label( 'name', 'id', array( 'generated' => true )
),
+ 'label() can not be given a generated attribute'
+ );
+ $this->assertEquals(
+ '<label for="id" class="nice">name</label>',
+ Xml::label( 'name', 'id', array( 'class' => 'nice' ) ),
+ 'label() can get a class attribute'
+ );
+ $this->assertEquals(
+ '<label for="id" class="nice">name</label>',
+ Xml::label( 'name', 'id', array(
+ 'generated' => true,
+ 'class' => 'nice',
+ 'anotherattr' => 'value',
+ )
+ ),
+ 'label() skip all attributes but "class"'
+ );
+ }
+
+ #
# JS
#
function testEscapeJsStringSpecialChars() {
_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs