function EntityDisplayTest::testEntityForm

Same name in other branches
  1. 9 core/modules/field_ui/tests/src/FunctionalJavascript/EntityDisplayTest.php \Drupal\Tests\field_ui\FunctionalJavascript\EntityDisplayTest::testEntityForm()
  2. 8.9.x core/modules/field_ui/tests/src/FunctionalJavascript/EntityDisplayTest.php \Drupal\Tests\field_ui\FunctionalJavascript\EntityDisplayTest::testEntityForm()
  3. 11.x core/modules/field_ui/tests/src/FunctionalJavascript/EntityDisplayTest.php \Drupal\Tests\field_ui\FunctionalJavascript\EntityDisplayTest::testEntityForm()

Tests the use of regions for entity form displays.

1 method overrides EntityDisplayTest::testEntityForm()
ClaroEntityDisplayTest::testEntityForm in core/tests/Drupal/FunctionalJavascriptTests/Theme/ClaroEntityDisplayTest.php
Copied from parent.

File

core/modules/field_ui/tests/src/FunctionalJavascript/EntityDisplayTest.php, line 54

Class

EntityDisplayTest
Tests the UI for entity displays.

Namespace

Drupal\Tests\field_ui\FunctionalJavascript

Code

public function testEntityForm() : void {
    $this->drupalGet('entity_test/manage/1/edit');
    $this->assertSession()
        ->fieldExists('field_test_text[0][value]');
    $this->drupalGet('entity_test/structure/entity_test/form-display');
    $this->assertTrue($this->assertSession()
        ->optionExists('fields[field_test_text][region]', 'content')
        ->isSelected());
    $this->getSession()
        ->getPage()
        ->pressButton('Show row weights');
    $this->assertSession()
        ->waitForElementVisible('css', '[name="fields[field_test_text][region]"]');
    $this->getSession()
        ->getPage()
        ->selectFieldOption('fields[field_test_text][region]', 'hidden');
    $this->assertTrue($this->assertSession()
        ->optionExists('fields[field_test_text][region]', 'hidden')
        ->isSelected());
    $this->submitForm([], 'Save');
    $this->assertSession()
        ->pageTextContains('Your settings have been saved.');
    $this->assertTrue($this->assertSession()
        ->optionExists('fields[field_test_text][region]', 'hidden')
        ->isSelected());
    $this->drupalGet('entity_test/manage/1/edit');
    $this->assertSession()
        ->fieldNotExists('field_test_text[0][value]');
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.