diff --git a/core/modules/image/tests/src/FunctionalJavascript/QuickEditImageTest.php b/core/modules/image/tests/src/FunctionalJavascript/QuickEditImageTest.php index 04cc223..4fd3f59 100644 --- a/core/modules/image/tests/src/FunctionalJavascript/QuickEditImageTest.php +++ b/core/modules/image/tests/src/FunctionalJavascript/QuickEditImageTest.php @@ -20,7 +20,7 @@ class QuickEditImageTest extends JavascriptTestBase { /** * {@inheritdoc} */ - public static $modules = ['node', 'image', 'field_ui', 'contextual', 'quickedit']; + public static $modules = ['node', 'image', 'field_ui', 'contextual', 'quickedit', 'toolbar']; /** * A user with permissions to edit Articles and use Quick Edit. @@ -41,6 +41,7 @@ protected function setUp() { // Log in as a content author who can use Quick Edit and edit Articles. $this->contentAuthorUser = $this->drupalCreateUser([ 'access contextual links', + 'access toolbar', 'access in-place editing', 'access content', 'create article content', @@ -118,7 +119,8 @@ public function testUpload() { $this->assertJsCondition($condition, 10000); // Initiate Quick Editing. - $this->triggerClick($entity_selector . ' [data-contextual-id] > button'); + $this->click('.contextual-toolbar-tab button'); + $this->click($entity_selector . ' [data-contextual-id] > button'); $this->click($entity_selector . ' [data-contextual-id] .quickedit > a'); $this->click($field_selector); @@ -156,7 +158,7 @@ public function testUpload() { $this->prepareRequest(); // Save the change. - $this->triggerClick('.quickedit-button.action-save'); + $this->click('.quickedit-button.action-save'); $this->assertSession()->assertWaitOnAjaxRequest(); // Re-visit the page to make sure the edit worked. @@ -166,19 +168,4 @@ public function testUpload() { $this->assertSession()->elementNotExists('css', $entity_selector . ' ' . $field_selector . ' ' . $original_image_selector); $this->assertSession()->elementExists('css', $entity_selector . ' ' . $field_selector . ' ' . $new_image_selector); } - - /** - * Clicks the element with the given CSS selector using event triggers. - * - * @todo Remove when https://github.com/jcalderonzumba/gastonjs/issues/19 - * is fixed. Currently clicking anchors/buttons with nested elements is not - * possible. - * - * @param string $css_selector - * The CSS selector identifying the element to click. - */ - protected function triggerClick($css_selector) { - $this->getSession()->executeScript("jQuery('" . $css_selector . "')[0].click()"); - } - }