Updated Drupal to 8.6. This goes with the following updates because it's possible...
[yaffs-website] / web / core / modules / contextual / tests / src / FunctionalJavascript / ContextualLinksTest.php
index de836924119fe900cbdf6b41a44b72f0dd41df73..29d2ec7be5b88975e28f3c046b11adc078b9fa50 100644 (file)
@@ -2,7 +2,7 @@
 
 namespace Drupal\Tests\contextual\FunctionalJavascript;
 
-use Drupal\FunctionalJavascriptTests\JavascriptTestBase;
+use Drupal\FunctionalJavascriptTests\WebDriverTestBase;
 use Drupal\user\Entity\Role;
 
 /**
@@ -10,7 +10,7 @@ use Drupal\user\Entity\Role;
  *
  * @group contextual
  */
-class ContextualLinksTest extends JavascriptTestBase {
+class ContextualLinksTest extends WebDriverTestBase {
 
   use ContextualLinkClickTrait;
 
@@ -92,4 +92,19 @@ class ContextualLinksTest extends JavascriptTestBase {
     $this->assertSession()->pageTextContains('Everything is contextual!');
   }
 
+  /**
+   * Test the contextual links destination.
+   */
+  public function testContextualLinksDestination() {
+    $this->grantPermissions(Role::load(Role::AUTHENTICATED_ID), [
+      'access contextual links',
+      'administer blocks',
+    ]);
+    $this->drupalGet('user');
+    $this->assertSession()->waitForElement('css', '.contextual button');
+    $expected_destination_value = (string) $this->loggedInUser->toUrl()->toString();
+    $contextual_link_url_parsed = parse_url($this->getSession()->getPage()->findLink('Configure block')->getAttribute('href'));
+    $this->assertEquals("destination=$expected_destination_value", $contextual_link_url_parsed['query']);
+  }
+
 }