From 73583da41165f2b6cd456bbb60a8ce15ecaf4341 Mon Sep 17 00:00:00 2001 From: Antoine Musso Date: Sun, 7 Nov 2010 10:06:22 +0000 Subject: [PATCH] Xml::label() tests. Follow up r63675. --- .../tests/phpunit/includes/XmlTest.php | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) 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 # -- 2.20.1