1 describe('Binding: Click', {
2 // This is just a special case of the "event" binding, so not necessary to respecify all its behaviours
3 before_each: JSSpec.prepareTestNode,
5 'Should invoke the supplied function on click, using model as \'this\' param and first arg, and event as second arg': function () {
8 doCall: function (arg1, arg2) {
10 value_of(arg1).should_be(model);
11 value_of(arg2.type).should_be("click");
14 testNode.innerHTML = "<button data-bind='click:doCall'>hey</button>";
15 ko.applyBindings(model, testNode);
16 ko.utils.triggerEvent(testNode.childNodes[0], "click");
17 value_of(model.wasCalled).should_be(true);