8000 Fix - #17676 (backport #17919 to 2.3) by Ocramius · Pull Request #17946 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

Fix - #17676 (backport #17919 to 2.3) #17946

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

Closed
Closed
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
ChoiceFormField of type "select" could be "disabled"
  • Loading branch information
bouland authored and fabpot committed Feb 26, 2016
commit 576c4b9b4259b9f3f59751f8349bdf6fbe640f23
4 changes: 4 additions & 0 deletions src/Symfony/Component/DomCrawler/Field/ChoiceFormField.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@ public function hasValue()
*/
public function isDisabled()
{
if (parent::isDisabled() && 'select' === $this->type) {
return true;
}

foreach ($this->options as $option) {
if ($option['value'] == $this->value && $option['disabled']) {
return true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,14 @@ public function testSelectWithEmptyBooleanAttribute()
$this->assertEquals('bar', $field->getValue());
}

public function testSelectIsDisabled()
{
$node = $this->createSelectNode(array('foo' => false, 'bar' => true), array('disabled' => 'disabled'));
$field = new ChoiceFormField($node);

$this->assertTrue($field->isDisabled(), '->isDisabled() returns true for selects with a disabled attribute');
}

public function testMultipleSelects()
{
$node = $this->createSelectNode(array('foo' => false, 'bar' => false), array('multiple' => 'multiple'));
Expand Down
0