Skip to content

Commit

Permalink
[Form] Add tests to prove that label is not rendered when is marked a…
Browse files Browse the repository at this point in the history
…s false
  • Loading branch information
stloyd committed Dec 11, 2012
1 parent 120547c commit d5426f0
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/Symfony/Component/Form/Tests/AbstractDivLayoutTest.php
Expand Up @@ -526,6 +526,23 @@ public function testLabelHasNoId()
);
}

public function testLabelIsNotRenderedWhenSetToFalse()
{
$form = $this->factory->createNamed('name', 'text', null, array(
'label' => false
));
$html = $this->renderRow($form->createView());

$this->assertMatchesXpath($html,
'/div
[
./input[@id="name"]
]
[count(//label)=0]
'
);
}

/**
* @dataProvider themeBlockInheritanceProvider
*/
Expand Down
19 changes: 19 additions & 0 deletions src/Symfony/Component/Form/Tests/AbstractTableLayoutTest.php
Expand Up @@ -39,6 +39,25 @@ public function testRow()
);
}

public function testLabelIsNotRenderedWhenSetToFalse()
{
$form = $this->factory->createNamed('name', 'text', null, array(
'label' => false
));
$html = $this->renderRow($form->createView());

$this->assertMatchesXpath($html,
'/tr
[
./td
[count(//label)=0]
/following-sibling::td
[./input[@id="name"]]
]
'
);
}

public function testRepeatedRow()
{
$form = $this->factory->createNamed('name', 'repeated');
Expand Down

0 comments on commit d5426f0

Please sign in to comment.