diff --git a/core/modules/system/tests/modules/test_page_test/src/Controller/Test.php b/core/modules/system/tests/modules/test_page_test/src/Controller/Test.php index e754eaf0c2..173a58a12d 100644 --- a/core/modules/system/tests/modules/test_page_test/src/Controller/Test.php +++ b/core/modules/system/tests/modules/test_page_test/src/Controller/Test.php @@ -123,4 +123,13 @@ public function metaRefresh() { return new RedirectResponse(Url::fromRoute('test_page_test.test_page', [], ['absolute' => TRUE])->toString(), 302); } + /** + * Embeds some JS which says "Hallo welt". + */ + public function testJavascript() { + $build['#markup'] = 'click here'; + $build['#attached']['library'][] = 'test_page_test/test_javascript'; + return $build; + } + } diff --git a/core/modules/system/tests/modules/test_page_test/test_page_test.routing.yml b/core/modules/system/tests/modules/test_page_test/test_page_test.routing.yml index e64a88d003..ea7c1e39f7 100644 --- a/core/modules/system/tests/modules/test_page_test/test_page_test.routing.yml +++ b/core/modules/system/tests/modules/test_page_test/test_page_test.routing.yml @@ -90,3 +90,10 @@ test_page_test.meta_refresh: _controller: '\Drupal\test_page_test\Controller\Test::metaRefresh' requirements: _access: 'TRUE' + +test_page_test.test_javascript: + path: '/test-javascript' + defaults: + _controller: '\Drupal\test_page_test\Controller\Test::testJavascript' + requirements: + _access: 'TRUE' diff --git a/core/tests/Drupal/FunctionalJavascriptTests/Tests/JavascriptTestBaseTest.php b/core/tests/Drupal/FunctionalJavascriptTests/Tests/JavascriptTestBaseTest.php index 57acc02992..7ce5ebb3bf 100644 --- a/core/tests/Drupal/FunctionalJavascriptTests/Tests/JavascriptTestBaseTest.php +++ b/core/tests/Drupal/FunctionalJavascriptTests/Tests/JavascriptTestBaseTest.php @@ -28,8 +28,10 @@ public function testAssertPageReloaded() { * @covers ::assertPageNotReloaded */ public function testAssertPageNotReloaded() { - $this->drupalGet(''); + $this->drupalGet('test-javascript'); $this->markCurrentPage(); + + $this->clickLink('click here'); $this->assertPageNotReloaded(); }