You are here

protected function SettingsTrayTestBase::assertEditModeDisabled in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/settings_tray/tests/src/FunctionalJavascript/SettingsTrayTestBase.php \Drupal\Tests\settings_tray\FunctionalJavascript\SettingsTrayTestBase::assertEditModeDisabled()
  2. 10 core/modules/settings_tray/tests/src/FunctionalJavascript/SettingsTrayTestBase.php \Drupal\Tests\settings_tray\FunctionalJavascript\SettingsTrayTestBase::assertEditModeDisabled()

Assert that edit mode has been properly disabled.

3 calls to SettingsTrayTestBase::assertEditModeDisabled()
SettingsTrayBlockFormTest::doTestBlocks in core/modules/settings_tray/tests/src/FunctionalJavascript/SettingsTrayBlockFormTest.php
Tests opening off-canvas dialog by click blocks and elements in the blocks.
SettingsTrayBlockFormTest::testEditModeEnableDisable in core/modules/settings_tray/tests/src/FunctionalJavascript/SettingsTrayBlockFormTest.php
Tests enabling and disabling Edit Mode.
SettingsTrayTestBase::disableEditMode in core/modules/settings_tray/tests/src/FunctionalJavascript/SettingsTrayTestBase.php
Disables edit mode by pressing edit button in the toolbar.

File

core/modules/settings_tray/tests/src/FunctionalJavascript/SettingsTrayTestBase.php, line 92

Class

SettingsTrayTestBase
Base class for Settings Tray tests.

Namespace

Drupal\Tests\settings_tray\FunctionalJavascript

Code

protected function assertEditModeDisabled() {
  $web_assert = $this
    ->assertSession();
  $page = $this
    ->getSession()
    ->getPage();
  $this
    ->getSession()
    ->executeScript("jQuery('[data-quickedit-entity-id]').trigger('mouseleave')");
  $page
    ->find('css', static::TOOLBAR_EDIT_LINK_SELECTOR)
    ->mouseOver();
  $this
    ->assertTrue($page
    ->waitFor(10, function ($page) {
    return !$page
      ->find('css', '.contextual .trigger:not(.visually-hidden)');
  }));

  // Contextual triggers should be hidden.
  $web_assert
    ->elementExists('css', '.contextual .trigger.visually-hidden');

  // No contextual triggers should be not hidden.
  $web_assert
    ->elementNotExists('css', '.contextual .trigger:not(.visually-hidden)');

  // The toolbar edit button should read "Edit".
  $web_assert
    ->elementContains('css', static::TOOLBAR_EDIT_LINK_SELECTOR, 'Edit');

  // The main canvas element should NOT have the "js-settings-tray-edit-mode"
  // class.
  $web_assert
    ->elementNotExists('css', '.dialog-off-canvas-main-canvas.js-settings-tray-edit-mode');
}