function SettingsTrayBlockFormTest::testEditModeEnableDisable

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

Tests enabling and disabling Edit Mode.

File

core/modules/settings_tray/tests/src/FunctionalJavascript/SettingsTrayBlockFormTest.php, line 233

Class

SettingsTrayBlockFormTest
Testing opening and saving block forms in the off-canvas dialog.

Namespace

Drupal\Tests\settings_tray\FunctionalJavascript

Code

public function testEditModeEnableDisable() {
    foreach ($this->getTestThemes() as $theme) {
        $this->enableTheme($theme);
        $block = $this->placeBlock('system_powered_by_block');
        foreach ([
            'contextual_link',
            'toolbar_link',
        ] as $enable_option) {
            $this->drupalGet('user');
            $this->assertEditModeDisabled();
            switch ($enable_option) {
                // Enable Edit mode.
                case 'contextual_link':
                    $this->clickContextualLink($this->getBlockSelector($block), "Quick edit");
                    $this->waitForOffCanvasToOpen();
                    $this->assertEditModeEnabled();
                    break;
                case 'toolbar_link':
                    $this->enableEditMode();
                    break;
            }
            $this->disableEditMode();
            // Make another page request to ensure Edit mode is still disabled.
            $this->drupalGet('user');
            $this->assertEditModeDisabled();
            // Make sure on this page request it also re-enables and disables
            // correctly.
            $this->enableEditMode();
            $this->disableEditMode();
        }
    }
}

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