Skip to content

Commit

Permalink
adding %arguments test
Browse files Browse the repository at this point in the history
  • Loading branch information
phillipskevin committed Sep 30, 2016
1 parent db4a5c2 commit f951ef5
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions test/bindings-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,25 @@ if (window.jQuery) {
ta.appendChild(frag);
var p0 = ta.getElementsByTagName("p")[0];
canEvent.trigger.call(p0, "myevent", ["myarg1", "myarg2"]);
});

test("extra args to handler can be read using `%arguments`", function () {
expect(4);
var template = stache("<p can-myevent='handleMyEvent(%arguments)'>{{content}}</p>");

var frag = template({
handleMyEvent: function(args) {
ok(true, "handleMyEvent called");
ok(args[0] instanceof window.jQuery.Event, "args[0] is a jquery event");
equal(args[1], "myarg1", "args[1] is the extra event args");
equal(args[2], "myarg2", "args[2] is the extra event args");
}
});

var ta = this.fixture;
ta.appendChild(frag);
var p0 = ta.getElementsByTagName("p")[0];
canEvent.trigger.call(p0, "myevent", ["myarg1", "myarg2"]);
});
}

Expand Down

0 comments on commit f951ef5

Please sign in to comment.