DEV: Add test for click-track and <a> without href.

DEV: Add test for click-track and without href.

Follow-up to b9339e15.

diff --git a/test/javascripts/lib/click-track-test.js.es6 b/test/javascripts/lib/click-track-test.js.es6
index 51d045b..a436db0 100644
--- a/test/javascripts/lib/click-track-test.js.es6
+++ b/test/javascripts/lib/click-track-test.js.es6
@@ -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>
@@ -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")));
+});
+
 QUnit.test("does not track attachments", async assert => {
   assert.expect(1);
   sandbox.stub(DiscourseURL, "origin").returns("http://discuss.domain.com");

GitHub sha: e67ba851

1 Like

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

1 Like