FIX: Make sure user preference to open external links in new tab works for bookmark list excerpts (#10409)

Meta post: https://meta.discourse.org/t/bookmark-page-does-not-respect-open-all-external-links-in-new-tab-user-preference/160118
This commit is contained in:
Martin Brennan
2020-08-13 14:56:13 +10:00
committed by GitHub
parent ffb31b8d2b
commit ef461ffd60
4 changed files with 151 additions and 105 deletions

View File

@ -140,7 +140,7 @@ QUnit.test("does not track right clicks inside quotes", async assert => {
QUnit.test("does not track clicks links in quotes", async assert => {
User.currentProp("external_links_in_new_tab", true);
assert.notOk(track(generateClickEventOn(".quote a:last-child")));
assert.ok(window.open.calledWith("https://google.com", "_blank"));
assert.ok(window.open.calledWith("https://google.com/", "_blank"));
});
QUnit.test("does not track clicks on category badges", async assert => {
@ -158,10 +158,10 @@ QUnit.test("removes the href and put it as a data attribute", async assert => {
var $link = fixture("a").first();
assert.ok($link.hasClass("no-href"));
assert.equal($link.data("href"), "http://www.google.com");
assert.equal($link.data("href"), "http://www.google.com/");
assert.blank($link.attr("href"));
assert.ok($link.data("auto-route"));
assert.ok(window.open.calledWith("http://www.google.com", "_blank"));
assert.ok(window.open.calledWith("http://www.google.com/", "_blank"));
});
QUnit.test("restores the href after a while", async assert => {