Skip to content

Commit

Permalink
Merge pull request LeaVerou#16804 from vlazar/fix/tests-for-new-feature
Browse files Browse the repository at this point in the history
Fix tests for new feature
  • Loading branch information
LeaVerou committed Dec 28, 2015
2 parents 5dbfd45 + 60b058e commit 958065c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
8 changes: 4 additions & 4 deletions test/events/mousedownSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ describe("mousedown event", function () {

describe("on left click", function () {
it("selects item", function () {
$.fire(this.target, "mousedown", { button: 0 });
expect(this.subject.select).toHaveBeenCalledWith(this.li);
var event = $.fire(this.target, "mousedown", { button: 0 });
expect(this.subject.select).toHaveBeenCalledWith(this.li, event);
});
});

Expand All @@ -48,8 +48,8 @@ describe("mousedown event", function () {
def("target", function () { return $("mark", this.li) });

it("selects item", function () {
$.fire(this.target, "mousedown", { button: 0 });
expect(this.subject.select).toHaveBeenCalledWith(this.li);
var event = $.fire(this.target, "mousedown", { button: 0 });
expect(this.subject.select).toHaveBeenCalledWith(this.li, event);
});
});
});
5 changes: 3 additions & 2 deletions test/specHelper.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,18 +40,19 @@ $.fire = function (target, type, properties) {
evt[j] = properties[j];
}
target.dispatchEvent(evt);
return evt;
};

// simulates text input (very simple, only "input" event is fired)
$.type = function (input, text) {
input.focus();
input.value = text;
$.fire(input, "input");
return $.fire(input, "input");
};

// simulates keydown events
$.keydown = function (target, keyCode) {
$.fire(target, "keydown", { keyCode: keyCode });
return $.fire(target, "keydown", { keyCode: keyCode });
};
$.k = {
ENTER: 13,
Expand Down

0 comments on commit 958065c

Please sign in to comment.