diff --git a/core/modules/outside_in/tests/src/FunctionalJavascript/OutsideInBlockFormTest.php b/core/modules/outside_in/tests/src/FunctionalJavascript/OutsideInBlockFormTest.php index dd79fc2..85f2a5f 100644 --- a/core/modules/outside_in/tests/src/FunctionalJavascript/OutsideInBlockFormTest.php +++ b/core/modules/outside_in/tests/src/FunctionalJavascript/OutsideInBlockFormTest.php @@ -51,6 +51,7 @@ protected function setUp() { * Tests opening Offcanvas tray by click blocks and elements in the blocks. */ public function testBlocks() { + $web_assert = $this->assertSession(); $blocks = [ [ 'id' => 'block-powered', @@ -94,7 +95,6 @@ public function testBlocks() { $page->pressButton($block['button_text']); // Make sure the changes are present. $this->getSession()->wait(500); - $web_assert = $this->assertSession(); $web_assert->pageTextContains($block['new_page_text']); } @@ -113,8 +113,16 @@ public function testBlocks() { // suppressed. $this->openBlockForm($element_selector); - // Exit edit mode. - $this->toggleEditingMode(); + // Exit edit mode using ESC. + $web_assert->elementTextContains('css', '.contextual-toolbar-tab button', 'Editing'); + $web_assert->elementAttributeContains('css', '#main-canvas', 'class', 'js-outside-in-edit-mode'); + // Simulate press the Escape key. + $this->getSession()->executeScript('jQuery("body").trigger(jQuery.Event("keyup", { keyCode: 27 }));'); + $this->waitForOffCanvasToClose(); + $this->getSession()->wait(100); + $web_assert->elementTextContains('css', '#drupal-live-announce', 'Exited edit mode.'); + $web_assert->elementTextNotContains('css', '.contextual-toolbar-tab button', 'Editing'); + $web_assert->elementAttributeNotContains('css', '#main-canvas', 'class', 'js-outside-in-edit-mode'); } }