Verified Commit bd6abf7c authored by Théodore Biadala's avatar Théodore Biadala
Browse files

Issue #3308432 by devkinetic, BramDriesen, Shifali Baghel, cilefen,...

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
parent 3dc29858
Loading
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -46,7 +46,7 @@
              {
                text: Drupal.t('Leave preview'),
                click() {
                  window.top.location.href = event.target.href;
                  window.top.location.href = event.currentTarget.href;
                },
              },
            ],
+16 −2
Original line number Diff line number Diff line
@@ -54,15 +54,29 @@ public function testPreviewLinks(): void {
    $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());
  }

}