$this->
openBlockForm("
$block_selector {
$element_selector}",
$block_selector);
$web_assert->
elementTextContains('css', '.contextual-toolbar-tab button', 'Editing'
);
$web_assert->
elementAttributeContains('css', '.dialog-off-canvas-main-canvas', 'class', 'js-settings-tray-edit-mode'
);
// Simulate press the Escape key.
$this->
getSession()->
executeScript('jQuery("body").trigger(jQuery.Event("keyup", { keyCode: 27 }));'
);
$this->
waitForOffCanvasToClose();
$this->
getSession()->
wait(100
);
$this->
getSession()->
getPage()->
find('css',
static::TOOLBAR_EDIT_LINK_SELECTOR
)->
mouseOver();
$this->
assertEditModeDisabled();
$this->
assertNotEmpty($web_assert->
waitForElement('css', '#drupal-live-announce:contains(Exited edit mode)'
));
$web_assert->
assertNoElementAfterWait('css', '.contextual-toolbar-tab button:contains(Editing)'
);
$web_assert->
elementAttributeNotContains('css', '.dialog-off-canvas-main-canvas', 'class', 'js-settings-tray-edit-mode'
);
// Clean up test data so each test does not impact the next.
$block->
delete();
if ($permissions) { user_role_revoke_permissions(Role::AUTHENTICATED_ID,
$permissions);
} } /**
* Creates tests for ::testBlocks().
*/