Skip to content

Commit 3b72f5c

Browse files
arkstefabpot
authored andcommitted
[Bridge\Twig] fix bootstrap checkbox_row to render properly & remove spaceless
1 parent 91e11c7 commit 3b72f5c

File tree

3 files changed

+24
-6
lines changed

3 files changed

+24
-6
lines changed

Tests/AbstractBootstrap3HorizontalLayoutTest.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,4 +154,13 @@ public function testStartTagWithExtraAttributes()
154154

155155
$this->assertSame('<form name="form" method="get" action="http://example.com/directory" class="foobar form-horizontal">', $html);
156156
}
157+
158+
public function testCheckboxRow()
159+
{
160+
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\CheckboxType');
161+
$view = $form->createView();
162+
$html = $this->renderRow($view, array('label' => 'foo'));
163+
164+
$this->assertMatchesXpath($html, '/div[@class="form-group"]/div[@class="col-sm-2" or @class="col-sm-10"]', 2);
165+
}
157166
}

Tests/AbstractBootstrap4HorizontalLayoutTest.php

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ public function testLabelOnForm()
2626
$html = $this->renderLabel($view);
2727

2828
$this->assertMatchesXpath($html,
29-
'/label
30-
[@class="col-form-label col-sm-2 form-control-label required"]
29+
'/legend
30+
[@class="col-form-label col-sm-2 col-form-legend required"]
3131
[.="[trans]Name[/trans]"]
3232
'
3333
);
@@ -118,7 +118,7 @@ public function testLegendOnExpandedType()
118118

119119
$this->assertMatchesXpath($html,
120120
'/legend
121-
[@class="col-sm-2 col-form-legend form-control-label required"]
121+
[@class="col-sm-2 col-form-legend required"]
122122
[.="[trans]Custom label[/trans]"]
123123
'
124124
);
@@ -178,4 +178,13 @@ public function testStartTagWithExtraAttributes()
178178

179179
$this->assertSame('<form name="form" method="get" action="http://example.com/directory" class="foobar">', $html);
180180
}
181+
182+
public function testCheckboxRow()
183+
{
184+
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\CheckboxType');
185+
$view = $form->createView();
186+
$html = $this->renderRow($view, array('label' => 'foo'));
187+
188+
$this->assertMatchesXpath($html, '/div[@class="form-group row"]/div[@class="col-sm-2" or @class="col-sm-10"]', 2);
189+
}
181190
}

Tests/AbstractBootstrap4LayoutTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ public function testLabelOnForm()
2828
$html = $this->renderLabel($view);
2929

3030
$this->assertMatchesXpath($html,
31-
'/label
32-
[@class="form-control-label required"]
31+
'/legend
32+
[@class="col-form-legend required"]
3333
[.="[trans]Name[/trans]"]
3434
'
3535
);
@@ -120,7 +120,7 @@ public function testLegendOnExpandedType()
120120

121121
$this->assertMatchesXpath($html,
122122
'/legend
123-
[@class="col-form-legend form-control-label required"]
123+
[@class="col-form-legend required"]
124124
[.="[trans]Custom label[/trans]"]
125125
'
126126
);

0 commit comments

Comments
 (0)