function FieldLayoutTest::testLayoutForms
Same name in other branches
- 8.9.x core/modules/field_layout/tests/src/FunctionalJavascript/FieldLayoutTest.php \Drupal\Tests\field_layout\FunctionalJavascript\FieldLayoutTest::testLayoutForms()
- 10 core/modules/field_layout/tests/src/FunctionalJavascript/FieldLayoutTest.php \Drupal\Tests\field_layout\FunctionalJavascript\FieldLayoutTest::testLayoutForms()
- 11.x core/modules/field_layout/tests/src/FunctionalJavascript/FieldLayoutTest.php \Drupal\Tests\field_layout\FunctionalJavascript\FieldLayoutTest::testLayoutForms()
Tests layout plugins with forms.
File
-
core/
modules/ field_layout/ tests/ src/ FunctionalJavascript/ FieldLayoutTest.php, line 215
Class
- FieldLayoutTest
- Tests using field layout for entity displays.
Namespace
Drupal\Tests\field_layout\FunctionalJavascriptCode
public function testLayoutForms() {
$this->drupalGet('entity_test/structure/entity_test/display');
// Switch to a field layout with settings.
$this->click('#edit-field-layouts');
// Test switching between layouts with and without forms.
$this->getSession()
->getPage()
->selectFieldOption('field_layout', 'layout_test_plugin');
$this->assertSession()
->assertWaitOnAjaxRequest();
$this->assertSession()
->fieldExists('settings_wrapper[layout_settings][setting_1]');
$this->getSession()
->getPage()
->selectFieldOption('field_layout', 'layout_test_2col');
$this->assertSession()
->assertWaitOnAjaxRequest();
$this->assertSession()
->fieldNotExists('settings_wrapper[layout_settings][setting_1]');
$this->getSession()
->getPage()
->selectFieldOption('field_layout', 'layout_test_plugin');
$this->assertSession()
->assertWaitOnAjaxRequest();
$this->assertSession()
->fieldExists('settings_wrapper[layout_settings][setting_1]');
// Move the test field to the content region.
$this->getSession()
->getPage()
->pressButton('Show row weights');
$this->getSession()
->getPage()
->selectFieldOption('fields[field_test_text][region]', 'content');
$this->assertSession()
->assertWaitOnAjaxRequest();
$this->submitForm([], 'Save');
$this->drupalGet('entity_test/1');
$this->assertSession()
->pageTextContains('Blah: Default');
// Update the field layout settings.
$this->drupalGet('entity_test/structure/entity_test/display');
$this->click('#edit-field-layouts');
$this->getSession()
->getPage()
->fillField('settings_wrapper[layout_settings][setting_1]', 'Test text');
$this->submitForm([], 'Save');
$this->drupalGet('entity_test/1');
$this->assertSession()
->pageTextContains('Blah: Test text');
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.