Loading empty_fields.info.yml +1 −1 Original line number Diff line number Diff line name: Empty Fields description: Provides options for displaying empty fields. type: module core_version_requirement: ^8.8 || ^9 core_version_requirement: ^9 || ^10 tests/src/Functional/EmptyFieldsTest.php +5 −9 Original line number Diff line number Diff line Loading @@ -58,14 +58,16 @@ class EmptyFieldsTest extends BrowserTestBase { $field_value = $this->randomMachineName(); $edit = [$field_name . '[0][value]' => $field_value]; $this->drupalPostForm($this->webUser->toUrl('edit-form'), $edit, 'Save'); $this->drupalGet($this->webUser->toUrl('edit-form')); $this->submitForm($edit, 'Save'); // Verify that field is displayed when has value. $this->drupalGet($url); $this->assertSession()->responseContains($field_label); $this->assertSession()->responseContains($field_value); $edit = [$field_name . '[0][value]' => '']; $this->drupalPostForm($this->webUser->toUrl('edit-form'), $edit, 'Save'); $this->drupalGet($this->webUser->toUrl('edit-form')); $this->submitForm($edit, 'Save'); // Make sure empty field is hidden. $this->drupalGet($url); $this->assertSession()->responseNotContains($field_label); Loading @@ -83,13 +85,7 @@ class EmptyFieldsTest extends BrowserTestBase { $this->assertSession()->responseContains($field_label); $elements = $this->cssSelect('.empty-fields__nbsp div'); $this->assertCount(2, $elements); if (version_compare(\Drupal::VERSION, '9.0', '<')) { // See http://www.fileformat.info/info/unicode/char/00a0/index.htm $this->assertSame(' ', $elements[1]->getHtml()); } else { $this->assertSame(' ', $elements[1]->getHtml()); } // Tests 'text' plugin. $text = 'This field is empty'; Loading Loading
empty_fields.info.yml +1 −1 Original line number Diff line number Diff line name: Empty Fields description: Provides options for displaying empty fields. type: module core_version_requirement: ^8.8 || ^9 core_version_requirement: ^9 || ^10
tests/src/Functional/EmptyFieldsTest.php +5 −9 Original line number Diff line number Diff line Loading @@ -58,14 +58,16 @@ class EmptyFieldsTest extends BrowserTestBase { $field_value = $this->randomMachineName(); $edit = [$field_name . '[0][value]' => $field_value]; $this->drupalPostForm($this->webUser->toUrl('edit-form'), $edit, 'Save'); $this->drupalGet($this->webUser->toUrl('edit-form')); $this->submitForm($edit, 'Save'); // Verify that field is displayed when has value. $this->drupalGet($url); $this->assertSession()->responseContains($field_label); $this->assertSession()->responseContains($field_value); $edit = [$field_name . '[0][value]' => '']; $this->drupalPostForm($this->webUser->toUrl('edit-form'), $edit, 'Save'); $this->drupalGet($this->webUser->toUrl('edit-form')); $this->submitForm($edit, 'Save'); // Make sure empty field is hidden. $this->drupalGet($url); $this->assertSession()->responseNotContains($field_label); Loading @@ -83,13 +85,7 @@ class EmptyFieldsTest extends BrowserTestBase { $this->assertSession()->responseContains($field_label); $elements = $this->cssSelect('.empty-fields__nbsp div'); $this->assertCount(2, $elements); if (version_compare(\Drupal::VERSION, '9.0', '<')) { // See http://www.fileformat.info/info/unicode/char/00a0/index.htm $this->assertSame(' ', $elements[1]->getHtml()); } else { $this->assertSame(' ', $elements[1]->getHtml()); } // Tests 'text' plugin. $text = 'This field is empty'; Loading