diff --git a/core/modules/options/src/Tests/OptionsWidgetsTest.php b/core/modules/options/src/Tests/OptionsWidgetsTest.php index c140058..a229fa7 100644 --- a/core/modules/options/src/Tests/OptionsWidgetsTest.php +++ b/core/modules/options/src/Tests/OptionsWidgetsTest.php @@ -460,6 +460,8 @@ function testEmptyValue() { 'bundle' => 'entity_test', ]); $field->save(); + + // Change it to the check boxes/radio buttons widget. entity_get_form_display('entity_test', 'entity_test', 'default') ->setComponent($this->card1->getName(), [ 'type' => 'options_test_buttons', @@ -473,19 +475,19 @@ function testEmptyValue() { ]); $entity->save(); - // Display form. + // Display form: check that _none options are present and has label. $this->drupalGet('entity_test/manage/' . $entity->id()); $this->assertTrue($this->xpath('//div[@id=:id]//div[@class=:class]//input[@value=:value]', array(':id' => 'edit-card-1', ':class' => 'form-item form-type-radio form-item-card-1', ':value' => '_none')), 'A test radio button has a "None" choice.'); $this->assertTrue($this->xpath('//div[@id=:id]//div[@class=:class]//label[@for=:for and text()=:label]', array(':id' => 'edit-card-1', ':class' => 'form-item form-type-radio form-item-card-1', ':for' => 'edit-card-1-none', ':label' => 'N/A')), 'A test radio button has a "N/A" choice.'); - // + // Change it to the select widget. entity_get_form_display('entity_test', 'entity_test', 'default') ->setComponent($this->card1->getName(), array( 'type' => 'options_test_select', )) ->save(); - // Display form. + // Display form: check that _none options are present and has label. $this->drupalGet('entity_test/manage/' . $entity->id()); // A required field without any value has a "none" option. $this->assertTrue($this->xpath('//select[@id=:id]//option[@value="_none" and text()=:label]', array(':id' => 'edit-card-1', ':label' => t('- None -'))), 'A test select has a "None" choice.');