diff --git a/core/modules/node/tests/src/FunctionalJavascript/NodePreviewLinkTest.php b/core/modules/node/tests/src/FunctionalJavascript/NodePreviewLinkTest.php
new file mode 100644
index 0000000000..8eb7a268d0
--- /dev/null
+++ b/core/modules/node/tests/src/FunctionalJavascript/NodePreviewLinkTest.php
@@ -0,0 +1,60 @@
+ 'filtered_html',
+ 'name' => 'Filtered HTML',
+ ]);
+ $filtered_html_format->save();
+
+ $this->drupalCreateContentType(['type' => 'test']);
+
+ $user = $this->drupalCreateUser([
+ 'access content',
+ 'edit own test content',
+ 'create test content',
+ $filtered_html_format->getPermissionName(),
+ ]);
+ $this->drupalLogin($user);
+ }
+
+ /**
+ * Test the behavior of clicking preview links.
+ */
+ public function testPreviewLinks() {
+ $assertSession = $this->assertSession();
+ $this->drupalPostForm('node/add/test', [
+ 'title[0][value]' => 'Test node',
+ 'body[0][value]' => 'Anchor linkNormal link',
+ ], t('Preview'));
+ $this->clickLink('Anchor link');
+ $assertSession->pageTextNotContains('Leave preview?');
+ $this->clickLink('Normal link');
+ $assertSession->pageTextContains('Leave preview?');
+ $this->click('button:contains("Leave preview")');
+ $this->assertStringEndsWith('/foo', $this->getUrl());
+ }
+
+}