function SettingsTrayTestBase::assertEditModeEnabled

Same name in other branches
  1. 9 core/modules/settings_tray/tests/src/FunctionalJavascript/SettingsTrayTestBase.php \Drupal\Tests\settings_tray\FunctionalJavascript\SettingsTrayTestBase::assertEditModeEnabled()
  2. 10 core/modules/settings_tray/tests/src/FunctionalJavascript/SettingsTrayTestBase.php \Drupal\Tests\settings_tray\FunctionalJavascript\SettingsTrayTestBase::assertEditModeEnabled()
  3. 11.x core/modules/settings_tray/tests/src/FunctionalJavascript/SettingsTrayTestBase.php \Drupal\Tests\settings_tray\FunctionalJavascript\SettingsTrayTestBase::assertEditModeEnabled()

Assert that edit mode has been properly enabled.

2 calls to SettingsTrayTestBase::assertEditModeEnabled()
SettingsTrayBlockFormTest::testEditModeEnableDisable in core/modules/settings_tray/tests/src/FunctionalJavascript/SettingsTrayBlockFormTest.php
Tests enabling and disabling Edit Mode.
SettingsTrayTestBase::enableEditMode in core/modules/settings_tray/tests/src/FunctionalJavascript/SettingsTrayTestBase.php
Enables edit mode by pressing edit button in the toolbar.

File

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

Class

SettingsTrayTestBase
Base class for Settings Tray tests.

Namespace

Drupal\Tests\settings_tray\FunctionalJavascript

Code

protected function assertEditModeEnabled() {
    $web_assert = $this->assertSession();
    $page = $this->getSession()
        ->getPage();
    // Move the mouse over the toolbar button so that isn't over a contextual
    // links area which cause the contextual link to be shown.
    $page->find('css', static::TOOLBAR_EDIT_LINK_SELECTOR)
        ->mouseOver();
    $this->assertTrue($page->waitFor(10, function ($page) {
        return !$page->find('css', '.contextual .trigger.visually-hidden');
    }));
    // No contextual triggers should be hidden.
    $web_assert->elementNotExists('css', '.contextual .trigger.visually-hidden');
    // The toolbar edit button should read "Editing".
    $web_assert->elementContains('css', static::TOOLBAR_EDIT_LINK_SELECTOR, 'Editing');
    // The main canvas element should have the "js-settings-tray-edit-mode" class.
    $web_assert->elementExists('css', '.dialog-off-canvas-main-canvas.js-settings-tray-edit-mode');
}

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