From 791400ed2080c1fb2c262249c9202eff1b3eb78e Mon Sep 17 00:00:00 2001 From: darylteo Date: Mon, 4 Jan 2016 23:45:25 +1100 Subject: [PATCH] Tests for #5 --- tests/lib/proto/attach-link.js | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/tests/lib/proto/attach-link.js b/tests/lib/proto/attach-link.js index 29202c1..fef1bfc 100644 --- a/tests/lib/proto/attach-link.js +++ b/tests/lib/proto/attach-link.js @@ -56,3 +56,22 @@ tape("test attach link prototype method", function(t) { t.end() }) + +tape("test attach link preventDefaulted events", function(t) { + var callbacked = false + var a = document.createElement("a") + + attachLink.call({ + options: {}, + loadUrl: function() { + callbacked = true + } + }, a) + + a.href = "#" + on(a, "click", preventDefault) + trigger(a, "click") + t.equal(callbacked, false, "events that are preventDefaulted should not fire callback") + + t.end() +})