Skip to content

Commit

Permalink
DEV: Add test for click-track and <a> without href.
Browse files Browse the repository at this point in the history
Follow-up to b9339e1.
  • Loading branch information
nbianca committed May 6, 2019
1 parent 5e546ba commit e67ba85
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions test/javascripts/lib/click-track-test.js.es6
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ QUnit.module("lib:click-track", {
<a class="attachment" href="http://discuss.domain.com/uploads/default/1234/1532357280.txt">log.txt</a>
<a class="hashtag" href="http://discuss.domain.com">#hashtag</a>
<a class="mailto" href="mailto:foo@bar.com">email-me</a>
<a class="a-without-href">no href</a>
<aside class="quote">
<a href="https://discuss.domain.com/t/welcome-to-meta-discourse-org/1/30">foo</a>
<a href="https://google.com">bar</a>
Expand Down Expand Up @@ -65,6 +66,10 @@ QUnit.test("tracks internal URLs", async assert => {
assert.notOk(track(generateClickEventOn("#same-site")));
});

QUnit.test("does not track elements with no href", async assert => {
assert.ok(track(generateClickEventOn(".attachment")));

This comment has been minimized.

Copy link
@ZogStriP

ZogStriP May 6, 2019

Member

I think you meant to write: generateClickEventOn(".a-without-href")

});

QUnit.test("does not track attachments", async assert => {
assert.expect(1);
sandbox.stub(DiscourseURL, "origin").returns("http://discuss.domain.com");
Expand Down

0 comments on commit e67ba85

Please sign in to comment.