function LayoutBuilderOptInTest::testCheckboxLogic
Same name in other branches
- 9 core/modules/layout_builder/tests/src/FunctionalJavascript/LayoutBuilderOptInTest.php \Drupal\Tests\layout_builder\FunctionalJavascript\LayoutBuilderOptInTest::testCheckboxLogic()
- 8.9.x core/modules/layout_builder/tests/src/FunctionalJavascript/LayoutBuilderOptInTest.php \Drupal\Tests\layout_builder\FunctionalJavascript\LayoutBuilderOptInTest::testCheckboxLogic()
- 10 core/modules/layout_builder/tests/src/FunctionalJavascript/LayoutBuilderOptInTest.php \Drupal\Tests\layout_builder\FunctionalJavascript\LayoutBuilderOptInTest::testCheckboxLogic()
Tests the interaction between the two layout checkboxes.
File
-
core/
modules/ layout_builder/ tests/ src/ FunctionalJavascript/ LayoutBuilderOptInTest.php, line 54
Class
- LayoutBuilderOptInTest
- Tests the ability for opting in and out of Layout Builder.
Namespace
Drupal\Tests\layout_builder\FunctionalJavascriptCode
public function testCheckboxLogic() : void {
$assert_session = $this->assertSession();
$page = $this->getSession()
->getPage();
$this->drupalGet('admin/structure/types/manage/before/display/default');
// Both fields are unchecked and allow_custom is disabled and hidden.
$assert_session->checkboxNotChecked('layout[enabled]');
$assert_session->checkboxNotChecked('layout[allow_custom]');
$assert_session->fieldDisabled('layout[allow_custom]');
$this->assertFalse($page->findField('layout[allow_custom]')
->isVisible());
// Checking is_enable will show allow_custom.
$page->checkField('layout[enabled]');
$assert_session->checkboxNotChecked('layout[allow_custom]');
$this->assertTrue($page->findField('layout[allow_custom]')
->isVisible());
$page->pressButton('Save');
$assert_session->checkboxChecked('layout[enabled]');
$assert_session->checkboxNotChecked('layout[allow_custom]');
// Check and submit allow_custom.
$page->checkField('layout[allow_custom]');
$page->pressButton('Save');
$assert_session->checkboxChecked('layout[enabled]');
$assert_session->checkboxChecked('layout[allow_custom]');
// Reset the checkboxes.
$this->disableLayoutBuilderFromUi('before', 'default');
$assert_session->checkboxNotChecked('layout[enabled]');
$assert_session->checkboxNotChecked('layout[allow_custom]');
// Check both at the same time.
$page->checkField('layout[enabled]');
$page->checkField('layout[allow_custom]');
$page->pressButton('Save');
$assert_session->checkboxChecked('layout[enabled]');
$assert_session->checkboxChecked('layout[allow_custom]');
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.