public function LayoutBuilderTest::testLayoutNoDialog in Drupal 8
Same name and namespace in other branches
- 9 core/modules/layout_builder/tests/src/FunctionalJavascript/LayoutBuilderTest.php \Drupal\Tests\layout_builder\FunctionalJavascript\LayoutBuilderTest::testLayoutNoDialog()
- 10 core/modules/layout_builder/tests/src/FunctionalJavascript/LayoutBuilderTest.php \Drupal\Tests\layout_builder\FunctionalJavascript\LayoutBuilderTest::testLayoutNoDialog()
Tests bypassing the off-canvas dialog.
File
- core/
modules/ layout_builder/ tests/ src/ FunctionalJavascript/ LayoutBuilderTest.php, line 325
Class
- LayoutBuilderTest
- Tests the Layout Builder UI.
Namespace
Drupal\Tests\layout_builder\FunctionalJavascriptCode
public function testLayoutNoDialog() {
$layout_url = 'node/1/layout';
\Drupal::entityTypeManager()
->getStorage('entity_view_display')
->create([
'targetEntityType' => 'node',
'bundle' => 'bundle_with_section_field',
'mode' => 'full',
])
->enable()
->setThirdPartySetting('layout_builder', 'enabled', TRUE)
->setThirdPartySetting('layout_builder', 'allow_custom', TRUE)
->save();
$assert_session = $this
->assertSession();
$page = $this
->getSession()
->getPage();
// Set up a layout with one section.
$this
->drupalGet(Url::fromRoute('layout_builder.choose_section', [
'section_storage_type' => 'overrides',
'section_storage' => 'node.1',
'delta' => 0,
]));
$assert_session
->linkExists('One column');
$this
->clickLink('One column');
$page
->pressButton('Add section');
// Add a block.
$this
->drupalGet(Url::fromRoute('layout_builder.add_block', [
'section_storage_type' => 'overrides',
'section_storage' => 'node.1',
'delta' => 0,
'region' => 'content',
'plugin_id' => 'system_powered_by_block',
]));
$assert_session
->assertNoElementAfterWait('css', '#drupal-off-canvas');
$page
->fillField('settings[label]', 'The block label');
$page
->fillField('settings[label_display]', TRUE);
$page
->pressButton('Add block');
$assert_session
->addressEquals($layout_url);
$assert_session
->pageTextContains('Powered by Drupal');
$assert_session
->pageTextContains('The block label');
// Remove the section.
$this
->drupalGet(Url::fromRoute('layout_builder.remove_section', [
'section_storage_type' => 'overrides',
'section_storage' => 'node.1',
'delta' => 0,
]));
$page
->pressButton('Remove');
$assert_session
->addressEquals($layout_url);
$assert_session
->pageTextNotContains('Powered by Drupal');
$assert_session
->pageTextNotContains('The block label');
$assert_session
->linkNotExists('Add block');
}