function LayoutBuilderUiTest::assertModifiedLayout

Same name in other branches
  1. 9 core/modules/layout_builder/tests/src/FunctionalJavascript/LayoutBuilderUiTest.php \Drupal\Tests\layout_builder\FunctionalJavascript\LayoutBuilderUiTest::assertModifiedLayout()
  2. 8.9.x core/modules/layout_builder/tests/src/FunctionalJavascript/LayoutBuilderUiTest.php \Drupal\Tests\layout_builder\FunctionalJavascript\LayoutBuilderUiTest::assertModifiedLayout()
  3. 10 core/modules/layout_builder/tests/src/FunctionalJavascript/LayoutBuilderUiTest.php \Drupal\Tests\layout_builder\FunctionalJavascript\LayoutBuilderUiTest::assertModifiedLayout()

Asserts that modifying a layout works as expected.

@internal

Parameters

string $path: The path to a Layout Builder UI page.

1 call to LayoutBuilderUiTest::assertModifiedLayout()
LayoutBuilderUiTest::testUnsavedChangesMessage in core/modules/layout_builder/tests/src/FunctionalJavascript/LayoutBuilderUiTest.php
Tests the message indicating unsaved changes.

File

core/modules/layout_builder/tests/src/FunctionalJavascript/LayoutBuilderUiTest.php, line 126

Class

LayoutBuilderUiTest
Tests the Layout Builder UI.

Namespace

Drupal\Tests\layout_builder\FunctionalJavascript

Code

protected function assertModifiedLayout(string $path) : void {
    $assert_session = $this->assertSession();
    $page = $this->getSession()
        ->getPage();
    $this->drupalGet($path);
    $page->clickLink('Add section');
    $assert_session->waitForElementVisible('named', [
        'link',
        'One column',
    ]);
    $assert_session->pageTextNotContains('You have unsaved changes.');
    $page->clickLink('One column');
    $assert_session->waitForElementVisible('named', [
        'button',
        'Add section',
    ]);
    $page->pressButton('Add section');
    $assert_session->assertWaitOnAjaxRequest();
    $assert_session->pageTextContainsOnce('You have unsaved changes.');
    // Reload the page.
    $this->drupalGet($path);
    $assert_session->pageTextContainsOnce('You have unsaved changes.');
}

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