Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

[Form] Add tests to prove that label is not rendered when is marked a…

…s false
  • Loading branch information...
commit f16bb460d96d0d7652e217f5b1797c4c57280ceb 1 parent 0679b54
Joseph Bielawski authored December 11, 2012
17  Tests/AbstractDivLayoutTest.php
@@ -526,6 +526,23 @@ public function testLabelHasNoId()
526 526
         );
527 527
     }
528 528
 
  529
+    public function testLabelIsNotRenderedWhenSetToFalse()
  530
+    {
  531
+        $form = $this->factory->createNamed('name', 'text', null, array(
  532
+            'label' => false
  533
+        ));
  534
+        $html = $this->renderRow($form->createView());
  535
+
  536
+        $this->assertMatchesXpath($html,
  537
+'/div
  538
+    [
  539
+        ./input[@id="name"]
  540
+    ]
  541
+    [count(//label)=0]
  542
+'
  543
+        );
  544
+    }
  545
+
529 546
     /**
530 547
      * @dataProvider themeBlockInheritanceProvider
531 548
      */
19  Tests/AbstractTableLayoutTest.php
@@ -39,6 +39,25 @@ public function testRow()
39 39
         );
40 40
     }
41 41
 
  42
+    public function testLabelIsNotRenderedWhenSetToFalse()
  43
+    {
  44
+        $form = $this->factory->createNamed('name', 'text', null, array(
  45
+            'label' => false
  46
+        ));
  47
+        $html = $this->renderRow($form->createView());
  48
+
  49
+        $this->assertMatchesXpath($html,
  50
+'/tr
  51
+    [
  52
+        ./td
  53
+            [count(//label)=0]
  54
+        /following-sibling::td
  55
+            [./input[@id="name"]]
  56
+    ]
  57
+'
  58
+        );
  59
+    }
  60
+
42 61
     public function testRepeatedRow()
43 62
     {
44 63
         $form = $this->factory->createNamed('name', 'repeated');

0 notes on commit f16bb46

Please sign in to comment.
Something went wrong with that request. Please try again.