Commit f8b42ed9 authored by utkarsh_33's avatar utkarsh_33 Committed by Tim Plunkett
Browse files

Issue #3306162 by Utkarsh_33, srishtiiee, pflora: Adding target blank to all...

Issue #3306162 by Utkarsh_33, srishtiiee, pflora: Adding target blank to all the links in Module description page
parent d36a024f
Loading
Loading
Loading
Loading
+0 −0

File changed.

Preview suppressed by a .gitattributes entry or the file's encoding is unsupported.

+0 −0

File changed.

Preview suppressed by a .gitattributes entry or the file's encoding is unsupported.

+11 −1
Changes for sveltejs/src/ModulePage.svelte: 11 added lines, 1 removed line.
Original line number Diff line number Diff line
<script>
  import { onMount } from 'svelte';
  import ActionButton from './Project/ActionButton.svelte';
  import Image from './Project/Image.svelte';
  import ImageCarousel from './ImageCarousel.svelte';
@@ -14,6 +15,15 @@
    $page = 0;
    window.location.href = `${ORIGIN_URL}/admin/modules/browse`;
  }

  onMount(() => {
    const anchors = document
      .getElementById('description-wrapper')
      .getElementsByTagName('a');
    for (let i = 0; i < anchors.length; i++) {
      anchors[i].setAttribute('target', '_blank');
    }
  });
</script>

<ol class="pb-breadcrumb">
@@ -90,7 +100,7 @@
        <ImageCarousel sources={project.project_images} />
      </div>
    {/if}
    <div>{@html project.body.value}</div>
    <div id="description-wrapper">{@html project.body.value}</div>
  </div>
</div>

+1 −1
Changes for tests/fixtures/projects_fixture.json: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -475,7 +475,7 @@
    "status": "1",
    "project_data": {
      "body": {
        "summary": "<p>Text here for fake summary content.</p>"
        "summary": "<p>Text here for fake summary content. <a href=\"http://example.com\">Example</a></p>"
      },
      "field_project_images": [],
      "field_project_machine_name": "helvetica",
+16 −0
Changes for tests/src/FunctionalJavascript/ProjectBrowserUiTest.php: 16 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -216,6 +216,22 @@ class ProjectBrowserUiTest extends WebDriverTestBase {
    $this->assertTrue($assert_session->waitForText('23 Results'));
  }

  /**
   * Tests the Target blank functionality.
   */
  public function testTargetBlank(): void {
    $page = $this->getSession()->getPage();
    $assert_session = $this->assertSession();
    $this->drupalGet('admin/modules/browse');
    $this->svelteInitHelper('text', 'Helvetica');
    $page->clickLink('Helvetica');
    $this->assertTrue($assert_session->waitForText('Categories:'));
    $link = $page->find('css', '.box-2 a');
    $target = $link->getAttribute('target');
    $this->assertEquals('_blank', $target);

  }

  /**
   * Tests paging through results.
   */