Skip to content

Commit bd1cad2

Browse files
wimhendrikxnicolas-grekas
authored andcommitted
[TwigBridge] Allow floats in html5 input type number field
1 parent 8e2eaad commit bd1cad2

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

Tests/Extension/AbstractBootstrap3LayoutTestCase.php

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2154,6 +2154,25 @@ public function testRenderNumberWithHtml5NumberType()
21542154
$this->assertWidgetMatchesXpath($form->createView(), ['attr' => ['class' => 'my&class']],
21552155
'/input
21562156
[@type="number"]
2157+
[@step="any"]
2158+
[@name="name"]
2159+
[@class="my&class form-control"]
2160+
[@value="1234.56"]
2161+
'
2162+
);
2163+
}
2164+
2165+
public function testRenderNumberWithHtml5NumberTypeAndStepAttribute()
2166+
{
2167+
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\NumberType', 1234.56, [
2168+
'html5' => true,
2169+
'attr' => ['step' => '0.1'],
2170+
]);
2171+
2172+
$this->assertWidgetMatchesXpath($form->createView(), ['attr' => ['class' => 'my&class']],
2173+
'/input
2174+
[@type="number"]
2175+
[@step="0.1"]
21572176
[@name="name"]
21582177
[@class="my&class form-control"]
21592178
[@value="1234.56"]

0 commit comments

Comments
 (0)