Allow disabling link tracking with .no-track-link (#4160)
This commit is contained in:
parent
491c473e4e
commit
9bba68ed74
|
@ -11,7 +11,7 @@ export default {
|
|||
if (Discourse.Utilities.selectedText() !== "") { return false; }
|
||||
|
||||
var $link = $(e.currentTarget);
|
||||
if ($link.hasClass('lightbox') || $link.hasClass('mention-group')) { return true; }
|
||||
if ($link.hasClass('lightbox') || $link.hasClass('mention-group') || $link.hasClass('no-track-link')) { return true; }
|
||||
|
||||
var href = $link.attr('href') || $link.data('href'),
|
||||
$article = $link.closest('article'),
|
||||
|
|
|
@ -27,6 +27,7 @@ module("lib:click-track", {
|
|||
<a id="inside-onebox" href="http://www.google.com">google.com<span class="badge">1</span></a>
|
||||
<a id="inside-onebox-forced" class="track-link" href="http://www.google.com">google.com<span class="badge">1</span></a>
|
||||
</div>
|
||||
<a class="no-track-link" href="http://www.google.com">google.com</a>
|
||||
<a id="same-site" href="http://discuss.domain.com">forum</a>
|
||||
<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>
|
||||
|
@ -57,6 +58,10 @@ test("it calls preventDefault when clicking on an a", function() {
|
|||
ok(DiscourseURL.redirectTo.calledOnce);
|
||||
});
|
||||
|
||||
test("does not track clicks when forcibly disabled", function() {
|
||||
ok(track(generateClickEventOn('.no-track-link')));
|
||||
});
|
||||
|
||||
test("does not track clicks on back buttons", function() {
|
||||
ok(track(generateClickEventOn('.back')));
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue