You are here

public function LayoutBuilderUiTest::testUnsavedChangesMessage 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::testUnsavedChangesMessage()

Tests the message indicating unsaved changes.

File

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

Class

LayoutBuilderUiTest
Tests the Layout Builder UI.

Namespace

Drupal\Tests\layout_builder\FunctionalJavascript

Code

public function testUnsavedChangesMessage() {
  $assert_session = $this
    ->assertSession();
  $page = $this
    ->getSession()
    ->getPage();

  // Make and then discard changes.
  $this
    ->assertModifiedLayout(static::FIELD_UI_PREFIX . '/display/default/layout');
  $page
    ->pressButton('Discard changes');
  $page
    ->pressButton('Confirm');
  $assert_session
    ->pageTextNotContains('You have unsaved changes.');

  // Make and then save changes.
  $this
    ->assertModifiedLayout(static::FIELD_UI_PREFIX . '/display/default/layout');
  $page
    ->pressButton('Save layout');
  $assert_session
    ->pageTextNotContains('You have unsaved changes.');
}