8000 [Form] Added functional test for the 'size' attribute in the select t… · ivanrey/symfony@c6fe6a7 · GitHub
[go: up one dir, main page]

Skip to content

Commit c6fe6a7

Browse files
committed
[Form] Added functional test for the 'size' attribute in the select tags of a time field
1 parent e3db366 commit c6fe6a7

File tree

3 files changed

+10
-5
lines changed

3 files changed

+10
-5
lines changed

src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/time_widget.html.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22
<?php
33
10000 // There should be no spaces between the colons and the widgets, that's why
44
// this block is written in a single PHP tag
5-
echo $view['form']->widget($form['hour'], array('size' => 1));
5+
echo $view['form']->widget($form['hour'], array('attr' => array('size' => 1)));
66
echo ':';
7-
echo $view['form']->widget($form['minute'], array('size' => 1));
7+
echo $view['form']->widget($form['minute'], array('attr' => array('size' => 1)));
88

99
if ($with_seconds) {
1010
echo ':';
11-
echo $view['form']->widget($form['second'], array('size' => 1));
11+
echo $view['form']->widget($form['second'], array('attr' => array('size' => 1)));
1212
}
1313
?>
1414
</div>

src/Symfony/Bundle/TwigBundle/Resources/views/div_layout.html.twig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343

4444
{% block attributes %}
4545
{% spaceless %}
46-
id="{{ id }}" name="{{ name }}"{% if class %} class="{{ class }}"{% endif %}{% if read_only %} disabled="disabled"{% endif %}{% if required %} required="required"{% endif %}{% if max_length %} maxlength="{{ max_length }}"{% endif %}{% if size %} size="{{ size }}"{% endif %}
46+
id="{{ id }}" name="{{ name }}"{% if class %} class="{{ class }}"{% endif %}{% if read_only %} disabled="disabled"{% endif %}{% if required %} required="required"{% endif %}{% if max_length %} maxlength="{{ max_length }}"{% endif %}
4747
{% for attrname,attrvalue in attr %}{{attrname}}="{{attrvalue}}" {% endfor %}
4848
{% endspaceless %}
4949
{% endblock attributes %}
@@ -168,7 +168,7 @@
168168
{% block time__widget %}
169169
{% spaceless %}
170170
<div {{ block('attributes') }}>
171-
{{ form_widget(form.hour, { 'size': '1' }) }}:{{ form_widget(form.minute, { 'size': '1' }) }}{% if with_seconds %}:{{ form_widget(form.second, { 'size': '1' }) }}{% endif %}
171+
{{ form_widget(form.hour, { 'attr': { 'size': '1' } }) }}:{{ form_widget(form.minute, { 'attr': { 'size': '1' } }) }}{% if with_seconds %}:{{ form_widget(form.second, { 'attr': { 'size': '1' } }) }}{% endif %}
172172
</div>
173173
{% endspaceless %}
174174
{% endblock time__widget %}

tests/Symfony/Tests/Component/Form/AbstractLayoutTest.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -816,9 +816,11 @@ public function testTime()
816816
[
817817
./select
818818
[@id="name_hour"]
819+
[@size="1"]
819820
[./option[@value="4"][@selected="selected"]]
820821
/following-sibling::select
821822
[@id="name_minute"]
823+
[@size="1"]
822824
[./option[@value="5"][@selected="selected"]]
823825
]
824826
[count(./select)=2]
@@ -839,12 +841,15 @@ public function testTimeWithSeconds()
839841
[
840842
./select
841843
[@id="name_hour"]
844+
[@size="1"]
842845
[./option[@value="4"][@selected="selected"]]
843846
/following-sibling::select
844847
[@id="name_minute"]
848+
[@size="1"]
845849
[./option[@value="5"][@selected="selected"]]
846850
/following-sibling::select
847851
[@id="name_second"]
852+
[@size="1"]
848853
[./option[@value="6"][@selected="selected"]]
849854
]
850855
[count(./select)=3]

0 commit comments

Comments
 (0)
0