Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adding %arguments test #68

Merged
merged 1 commit into from
Sep 30, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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