Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

[TwigBridge][Form] Added missing help messages in form themes #35124

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 4, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
[TwigBridge][Form] Added missing help messages in form themes
  • Loading branch information
cmen committed Jan 1, 2020
commit 5374d4f210819afb64cfbcd69bcd024dfd707cf7
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ col-sm-10
<div class="{{ block('form_label_class') }}"></div>{#--#}
<div class="{{ block('form_group_class') }}">
{{- form_widget(form) -}}
{{- form_help(form) -}}
{{- form_errors(form) -}}
</div>{#--#}
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,13 +148,15 @@
{% block checkbox_row -%}
<div{% with {attr: row_attr|merge({class: (row_attr.class|default('') ~ ' form-group' ~ (not valid ? ' has-error'))|trim})} %}{{ block('attributes') }}{% endwith %}>
{{- form_widget(form) -}}
{{- form_help(form) -}}
{{- form_errors(form) -}}
</div>
{%- endblock checkbox_row %}

{% block radio_row -%}
<div{% with {attr: row_attr|merge({class: (row_attr.class|default('') ~ ' form-group' ~ (not valid ? ' has-error'))|trim})} %}{{ block('attributes') }}{% endwith %}>
{{- form_widget(form) -}}
{{- form_help(form) -}}
{{- form_errors(form) -}}
</div>
{%- endblock radio_row %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,7 @@
<div{% with {attr: row_attr|merge({class: (row_attr.class|default('') ~ ' row')|trim})} %}{{ block('attributes') }}{% endwith %}>
<div class="large-12 columns{% if not valid %} error{% endif %}">
{{ form_widget(form) }}
{{- form_help(form) -}}
{{ form_errors(form) }}
</div>
</div>
Expand All @@ -320,6 +321,7 @@
<div{% with {attr: row_attr|merge({class: (row_attr.class|default('') ~ ' row')|trim})} %}{{ block('attributes') }}{% endwith %}>
<div class="large-12 columns{% if not valid %} error{% endif %}">
{{ form_widget(form) }}
{{- form_help(form) -}}
{{ form_errors(form) }}
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,4 +163,23 @@ public function testCheckboxRow()

$this->assertMatchesXpath($html, '/div[@class="form-group"]/div[@class="col-sm-2" or @class="col-sm-10"]', 2);
}

public function testCheckboxRowWithHelp()
{
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\CheckboxType');
$html = $this->renderRow($form->createView(), ['label' => 'foo', 'help' => 'really helpful text']);

$this->assertMatchesXpath($html,
'/div
[@class="form-group"]
[
./div[@class="col-sm-2" or @class="col-sm-10"]
/following-sibling::div[@class="col-sm-2" or @class="col-sm-10"]
[
./span[text() = "[trans]really helpful text[/trans]"]
]
]
'
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,21 @@ public function testCheckboxWithValue()
);
}

public function testCheckboxRowWithHelp()
{
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\CheckboxType');
$html = $this->renderRow($form->createView(), ['label' => 'foo', 'help' => 'really helpful text']);

$this->assertMatchesXpath($html,
'/div
[@class="form-group"]
[
./span[text() = "[trans]really helpful text[/trans]"]
]
'
);
}

public function testSingleChoice()
{
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\ChoiceType', '&a', [
Expand Down Expand Up @@ -2277,6 +2292,21 @@ public function testRadioWithValue()
);
}

public function testRadioRowWithHelp()
{
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\RadioType', false);
$html = $this->renderRow($form->createView(), ['label' => 'foo', 'help' => 'really helpful text']);

$this->assertMatchesXpath($html,
'/div
[@class="form-group"]
[
./span[text() = "[trans]really helpful text[/trans]"]
]
'
);
}

public function testRange()
{
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\RangeType', 42, ['attr' => ['min' => 5]]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,25 @@ public function testCheckboxRowWithHelp()
./small[text() = "[trans]really helpful text[/trans]"]
]
]
'
);
}

public function testRadioRowWithHelp()
{
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\RadioType', false);
$html = $this->renderRow($form->createView(), ['label' => 'foo', 'help' => 'really helpful text']);

$this->assertMatchesXpath($html,
'/div
[@class="form-group row"]
[
./div[@class="col-sm-2" or @class="col-sm-10"]
/following-sibling::div[@class="col-sm-2" or @class="col-sm-10"]
[
./small[text() = "[trans]really helpful text[/trans]"]
]
]
'
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -422,6 +422,21 @@ public function testCheckboxWithValue()
);
}

public function testCheckboxRowWithHelp()
{
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\CheckboxType');
$html = $this->renderRow($form->createView(), ['label' => 'foo', 'help' => 'really helpful text']);

$this->assertMatchesXpath($html,
'/div
[@class="form-group"]
[
./small[text() = "[trans]really helpful text[/trans]"]
]
'
);
}

public function testSingleChoiceExpanded()
{
$form = $this->factory->createNamed('name', ChoiceType::class, '&a', [
Expand Down Expand Up @@ -1027,6 +1042,21 @@ public function testRadioWithValue()
);
}

public function testRadioRowWithHelp()
{
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\RadioType', false);
$html = $this->renderRow($form->createView(), ['label' => 'foo', 'help' => 'really helpful text']);

$this->assertMatchesXpath($html,
'/div
[@class="form-group"]
[
./small[text() = "[trans]really helpful text[/trans]"]
]
'
);
}

public function testButtonAttributeNameRepeatedIfTrue()
{
$form = $this->factory->createNamed('button', ButtonType::class, null, [
Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.