Skip to content

Commit 700a880

Browse files
committed
Merge branch '7.1' into 7.2
* 7.1: [FrameworkBundle] Add missing `not-compromised-password` entry in XSD [AssetMapper] Fix CssCompiler matches url in comments Add support for doctrine/persistence 4 Ensure TransportExceptionInterface populates stream debug data Fix typo in validators.sk.xlf [Mime] Fix body validity check in `Email` when using `Message::setBody()` Review Arabic translations for the validator Fixed mistakes in proper hebrew writing in the previous translation and confirmed the rest to be correct and in the same style. Review translation [Cache] Don't clear system caches on cache:clear [FrameworkBundle] Fix patching refs to the tmp warmup dir in files generated by optional cache warmers Mark Czech Validator translation as reviewed [PropertyInfo] Fix `TypeTest` duplicated assert [Validator] Fix `Url` constraint attribute assertion convert legacy types to TypeInfo types if getType() is not implemented [HtmlSanitizer] Avoid accessing non existent array key when checking for hosts validity Update validators.ar.xlf [DomCrawler] Make `ChoiceFormField::isDisabled` return `true` for unchecked disabled checkboxes
2 parents b176e1f + 7361d8f commit 700a880

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

Field/ChoiceFormField.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,10 @@ public function hasValue(): bool
4545
*/
4646
public function isDisabled(): bool
4747
{
48+
if ('checkbox' === $this->type) {
49+
return parent::isDisabled();
50+
}
51+
4852
if (parent::isDisabled() && 'select' === $this->type) {
4953
return true;
5054
}

Tests/Field/ChoiceFormFieldTest.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -272,6 +272,17 @@ public function testCheckboxWithEmptyBooleanAttribute()
272272
$this->assertEquals('foo', $field->getValue());
273273
}
274274

275+
public function testCheckboxIsDisabled()
276+
{
277+
$node = $this->createNode('input', '', ['type' => 'checkbox', 'name' => 'name', 'disabled' => '']);
278+
$field = new ChoiceFormField($node);
279+
280+
$this->assertTrue($field->isDisabled(), '->isDisabled() returns true when the checkbox is disabled, even if it is not checked');
281+
282+
$field->tick();
283+
$this->assertTrue($field->isDisabled(), '->isDisabled() returns true when the checkbox is disabled, even if it is checked');
284+
}
285+
275286
public function testTick()
276287
{
277288
$node = $this->createSelectNode(['foo' => false, 'bar' => false]);

0 commit comments

Comments
 (0)