Skip to content

Commit

Permalink
Revert "Presenting page links in navigation menu that are on the `ocw…
Browse files Browse the repository at this point in the history
….mit.edu…" (#1417)

This reverts commit 1563f6b.
  • Loading branch information
umar8hassan authored Jun 26, 2024
1 parent 260cab1 commit 588fcc7
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 24 deletions.
16 changes: 3 additions & 13 deletions base-theme/layouts/partials/external_resource_link.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,11 @@
{{- if and $isBroken $backupUrl -}}
{{- $href = $backupUrl -}}
{{- end -}}
{{- if not (in $href "ocw.mit.edu") -}}
{{- partial "link" (dict
{{- partial "link" (dict
"href" $href
"text" $text
"class" $className
"onClick" $onClick
"target" "_blank"
)
-}}
{{- else -}}
{{- partial "link" (dict
"href" $href
"text" $text
"class" "external-link"
"onClick" ""
)
-}}
{{- end -}}
)
-}}
19 changes: 8 additions & 11 deletions tests-e2e/ocw-ci-test-course/external-resources.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,7 @@ test("Nav external resource without warning directly opens a new tab", async ({
const link = page.getByRole("link", { name: "OCW (no warning)" })
await expect(link).toBeVisible()

const targetAttribute = await link.getAttribute("target")
expect(targetAttribute).toBeNull()

const classAttribute = await link.getAttribute("class")
expect(classAttribute).toContain("external-link")
await expectTriggerToOpenANewTab(page, "https://ocw.mit.edu/", link)
})

test("External resource in page opens a new tab", async ({ page }) => {
Expand All @@ -65,13 +61,14 @@ test("Broken external resource opens backup_url", async ({ page }) => {

const link = page.getByRole("link", { name: "broken external resource" })

const targetAttribute = await link.getAttribute("target")
expect(targetAttribute).toBeNull()

const classAttribute = await link.getAttribute("class")
expect(classAttribute).toContain("external-link")

await link.click()
const continueButton = page.getByRole("button", { name: "Continue" })

await expectTriggerToOpenANewTab(
page,
"https://old.ocw.mit.edu/",
continueButton
)
})

test("External resource opens confirmation modal", async ({ page }) => {
Expand Down

0 comments on commit 588fcc7

Please sign in to comment.