update front-end specs

This commit is contained in:
Régis Hanol
2013-07-10 22:59:16 +02:00
parent b94d26d798
commit 360695bb0a
2 changed files with 36 additions and 4 deletions

View File

@ -20,6 +20,7 @@ module("Discourse.ClickTrack", {
' <a id="inside-onebox-forced" class="track-link" href="http://www.google.com">google.com<span class="badge">1</span></a>',
' </div>',
' <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>',
' </article>',
'</div>'].join("\n"));
},
@ -156,6 +157,13 @@ test("tracks via AJAX if we're on the same site", function() {
ok(Discourse.URL.routeTo.calledOnce);
});
test("does not track via AJAX for attachments", function() {
this.stub(Discourse.URL, "routeTo");
this.stub(Discourse.URL, "origin").returns("http://discuss.domain.com");
ok(!track(generateClickEventOn('.attachment')));
ok(Discourse.URL.redirectTo.calledOnce);
});
test("tracks custom urls when opening in another window", function() {
var clickEvent = generateClickEventOn('a');