Issue #3308432 by devkinetic, BramDriesen, Shifali Baghel, cilefen, smustgrave, quietone, bnjmnm: The link on the Image tag is redirecting to an undefined page from the node preview screen

merge-requests/8934/head
nod_ 2024-07-25 21:28:35 +02:00
parent 3dc298586a
commit bd6abf7c4d
No known key found for this signature in database
GPG Key ID: 76624892606FA197
2 changed files with 17 additions and 3 deletions

View File

@ -46,7 +46,7 @@
{
text: Drupal.t('Leave preview'),
click() {
window.top.location.href = event.target.href;
window.top.location.href = event.currentTarget.href;
},
},
],

View File

@ -54,15 +54,29 @@ class NodePreviewLinkTest extends WebDriverTestBase {
$assertSession = $this->assertSession();
$this->drupalGet('node/add/test');
$this->submitForm([
'title[0][value]' => 'Test node',
'body[0][value]' => '<a href="#foo">Anchor link</a><a href="/foo">Normal link</a>',
'title[0][value]' => 'Test anchor link',
'body[0][value]' => '<a href="#foo">Anchor link</a>',
], 'Preview');
$this->clickLink('Anchor link');
$assertSession->pageTextNotContains('Leave preview?');
$this->drupalGet('node/add/test');
$this->submitForm([
'title[0][value]' => 'Test normal link',
'body[0][value]' => '<a href="/foo">Normal link</a>',
], 'Preview');
$this->clickLink('Normal link');
$assertSession->pageTextContains('Leave preview?');
$this->click('button:contains("Leave preview")');
$this->assertStringEndsWith('/foo', $this->getUrl());
$this->drupalGet('node/add/test');
$this->submitForm([
'title[0][value]' => 'Test child element link',
'body[0][value]' => '<a href="/foo" class="preview-child-element"><span>Child element link</span></a>',
], 'Preview');
$this->getSession()->getPage()->find('css', '.preview-child-element span')->click();
$assertSession->pageTextContains('Leave preview?');
$this->click('button:contains("Leave preview")');
$this->assertStringEndsWith('/foo', $this->getUrl());
}
}