You are here

protected function LayoutBuilderUiTest::assertModifiedLayout in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/layout_builder/tests/src/FunctionalJavascript/LayoutBuilderUiTest.php \Drupal\Tests\layout_builder\FunctionalJavascript\LayoutBuilderUiTest::assertModifiedLayout()

Asserts that modifying a layout works as expected.

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 112

Class

LayoutBuilderUiTest
Tests the Layout Builder UI.

Namespace

Drupal\Tests\layout_builder\FunctionalJavascript

Code

protected function assertModifiedLayout($path) {
  $assert_session = $this
    ->assertSession();
  $page = $this
    ->getSession()
    ->getPage();
  $this
    ->drupalGet($path);
  $page
    ->clickLink('Add section');
  $assert_session
    ->assertWaitOnAjaxRequest();
  $assert_session
    ->pageTextNotContains('You have unsaved changes.');
  $page
    ->clickLink('One column');
  $assert_session
    ->assertWaitOnAjaxRequest();
  $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.');
}