From bd1cad2b2fea04e24966c8b1f2b00710ebf26008 Mon Sep 17 00:00:00 2001 From: Wim Hendrikx Date: Sat, 21 Jan 2023 16:13:34 +0100 Subject: [PATCH] [TwigBridge] Allow floats in html5 input type number field --- .../AbstractBootstrap3LayoutTestCase.php | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/Tests/Extension/AbstractBootstrap3LayoutTestCase.php b/Tests/Extension/AbstractBootstrap3LayoutTestCase.php index aa52233a..16cb900b 100644 --- a/Tests/Extension/AbstractBootstrap3LayoutTestCase.php +++ b/Tests/Extension/AbstractBootstrap3LayoutTestCase.php @@ -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"]