Skip to content

Commit

Permalink
[TwigBridge] Allow floats in html5 input type number field
Browse files Browse the repository at this point in the history
  • Loading branch information
wimhendrikx authored and nicolas-grekas committed Feb 23, 2023
1 parent 8e2eaad commit bd1cad2
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions Tests/Extension/AbstractBootstrap3LayoutTestCase.php
Expand Up @@ -2154,6 +2154,25 @@ public function testRenderNumberWithHtml5NumberType()
$this->assertWidgetMatchesXpath($form->createView(), ['attr' => ['class' => 'my&class']],
'/input
[@type="number"]
[@step="any"]
[@name="name"]
[@class="my&class form-control"]
[@value="1234.56"]
'
);
}

public function testRenderNumberWithHtml5NumberTypeAndStepAttribute()
{
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\NumberType', 1234.56, [
'html5' => true,
'attr' => ['step' => '0.1'],
]);

$this->assertWidgetMatchesXpath($form->createView(), ['attr' => ['class' => 'my&class']],
'/input
[@type="number"]
[@step="0.1"]
[@name="name"]
[@class="my&class form-control"]
[@value="1234.56"]
Expand Down

0 comments on commit bd1cad2

Please sign in to comment.