Skip to content

Commit

Permalink
Merge branch '4.4' into 5.0
Browse files Browse the repository at this point in the history
* 4.4: (26 commits)
  [HttpClient] NativeHttpClient should not send >1.1 protocol version
  [HttpClient] fix support for non-blocking resource streams
  [Mailer] Make sure you can pass custom headers to Mailgun
  [Mailer] Remove line breaks in email attachment content
  Update links to documentation
  [Validator] Add the missing translations for the Arabic (ar) locale
  ensure to expect no validation for the right reasons
  [Security-Guard] fixed 35203 missing name tag in param docblock
  [HttpClient] fix casting responses to PHP streams
  [PhpUnitBridge] Add test case for @expectedDeprecation annotation
  [PhpUnitBridge][SymfonyTestsListenerTrait] Remove $testsWithWarnings stack
  [Mailer] Fix addresses management in Sendgrid API payload
  [Mailer][MailchimpBridge] Fix missing attachments when sending via Mandrill API
  [Mailer][MailchimpBridge] Fix incorrect sender address when sender has name
  [HttpClient] fix capturing SSL certificates with NativeHttpClient
  Update year in license files
  [TwigBridge][Form] Added missing help messages in form themes
  Update year in license files
  Update year in license files
  fix version when "anonymous: lazy" was introduced
  ...
  • Loading branch information
nicolas-grekas committed Jan 4, 2020
2 parents abbaeee + 4dc3230 commit 15c3a62
Show file tree
Hide file tree
Showing 8 changed files with 104 additions and 1 deletion.
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2004-2019 Fabien Potencier
Copyright (c) 2004-2020 Fabien Potencier

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
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
2 changes: 2 additions & 0 deletions Resources/views/Form/bootstrap_3_layout.html.twig
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
2 changes: 2 additions & 0 deletions Resources/views/Form/foundation_5_layout.html.twig
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
19 changes: 19 additions & 0 deletions Tests/Extension/AbstractBootstrap3HorizontalLayoutTest.php
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]"]
]
]
'
);
}
}
30 changes: 30 additions & 0 deletions Tests/Extension/AbstractBootstrap3LayoutTest.php
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 @@ -2265,6 +2280,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
19 changes: 19 additions & 0 deletions Tests/Extension/AbstractBootstrap4HorizontalLayoutTest.php
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
30 changes: 30 additions & 0 deletions Tests/Extension/AbstractBootstrap4LayoutTest.php
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

0 comments on commit 15c3a62

Please sign in to comment.