Commit f5abb373 authored by Christian Fritsch's avatar Christian Fritsch Committed by Andrey Postnikov
Browse files

Issue #3266537 by chr.fritsch: Drupal 10 compatibility

parent c92e2a9e
Loading
Loading
Loading
Loading
+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
+5 −9
Original line number Diff line number Diff line
@@ -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);
@@ -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('&nbsp;', $elements[1]->getHtml());
    }

    // Tests 'text' plugin.
    $text = 'This field is empty';