migrated knockout asset to bower
[openemr.git] / public / assets / knockout-2-2-1 / spec / defaultBindings / clickBehaviors.js
blobd87f9aa3d97f11384dc7828b00d5e6a05818bc8b
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 () {
6         var model = {
7             wasCalled: false,
8             doCall: function (arg1, arg2) {
9                 this.wasCalled = true;
10                 value_of(arg1).should_be(model);
11                 value_of(arg2.type).should_be("click");
12             }
13         };
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);
18     }
19 });