From: Antoine Musso Date: Sun, 7 Nov 2010 10:06:22 +0000 (+0000) Subject: Xml::label() tests. Follow up r63675. X-Git-Tag: 1.31.0-rc.0~34025 X-Git-Url: https://git.cyclocoop.org/%7B%24admin_url%7Dmembres/cotisations/rappels.php?a=commitdiff_plain;h=73583da41165f2b6cd456bbb60a8ce15ecaf4341;p=lhc%2Fweb%2Fwiklou.git Xml::label() tests. Follow up r63675. --- diff --git a/maintenance/tests/phpunit/includes/XmlTest.php b/maintenance/tests/phpunit/includes/XmlTest.php index 27be6bab9b..7298f9f914 100644 --- a/maintenance/tests/phpunit/includes/XmlTest.php +++ b/maintenance/tests/phpunit/includes/XmlTest.php @@ -92,6 +92,39 @@ class XmlTest extends PHPUnit_Framework_TestCase { ); } + # + # input and label + # + function testLabelCreation() { + $this->assertEquals( + '', + Xml::label( 'name', 'id' ), + 'label() with no attribs' + ); + } + function testLabelAttributeCanOnlyBeClass() { + $this->assertEquals( + '', + Xml::label( 'name', 'id', array( 'generated' => true ) ), + 'label() can not be given a generated attribute' + ); + $this->assertEquals( + '', + Xml::label( 'name', 'id', array( 'class' => 'nice' ) ), + 'label() can get a class attribute' + ); + $this->assertEquals( + '', + Xml::label( 'name', 'id', array( + 'generated' => true, + 'class' => 'nice', + 'anotherattr' => 'value', + ) + ), + 'label() skip all attributes but "class"' + ); + } + # # JS #