FIX: Fix open quote links in new window. (#6477)

This commit is contained in:
Bianca Nenciu
2018-10-11 10:51:14 +03:00
committed by Régis Hanol
parent 09961fb425
commit 6275e745a7
2 changed files with 37 additions and 12 deletions

View File

@ -81,6 +81,26 @@ QUnit.test("does not track clicks to internal links in quotes", assert => {
);
});
QUnit.test("can open links inside quotes in new window", assert => {
sandbox.stub(DiscourseURL, "routeTo");
sandbox.stub(DiscourseURL, "origin").returns("http://discuss.domain.com");
track(
$.Event("click", {
currentTarget: fixture(".quote a:first-child")[0],
ctrlKey: true,
which: 1
})
);
assert.ok(
window.open.calledWith(
"https://discuss.domain.com/t/welcome-to-meta-discourse-org/1/30",
"_blank"
)
);
});
QUnit.test("does not track clicks to external links in quotes", assert => {
track(generateClickEventOn(".quote a:last-child"));
assert.ok(DiscourseURL.redirectTo.calledWith("https://google.com"));