Skip to content
This repository was archived by the owner on Sep 5, 2024. It is now read-only.

Commit a99cd33

Browse files
committed
test(interaction): add interaction spec for mousedown event + formats 4 spaces to 2
1 parent 7d65a4d commit a99cd33

File tree

1 file changed

+16
-7
lines changed

1 file changed

+16
-7
lines changed

src/core/services/interaction/interaction.spec.js

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,24 @@ describe("$mdInteraction", function() {
33

44
describe("last interaction type", function() {
55

6-
it("imitates a basic keyboard interaction and checks it", inject(function($mdInteraction) {
6+
it("imitates a basic keyboard interaction and checks it", inject(function($mdInteraction) {
77

8-
var event = document.createEvent('Event');
9-
event.keyCode = 37;
10-
event.initEvent('keydown', false, true);
11-
document.body.dispatchEvent(event);
8+
var event = document.createEvent('Event');
9+
event.keyCode = 37;
10+
event.initEvent('keydown', false, true);
11+
document.body.dispatchEvent(event);
1212

13-
expect($mdInteraction.getLastInteractionType()).toBe('keyboard');
14-
}));
13+
expect($mdInteraction.getLastInteractionType()).toBe('keyboard');
14+
}));
15+
16+
it("dispatches a mousedown event on the document body and checks it", inject(function($mdInteraction) {
17+
18+
var event = document.createEvent("MouseEvent");
19+
event.initMouseEvent("mousedown", true, true, window, null, 0, 0, 0, 0, false, false, false, false, 0, null);
20+
document.body.dispatchEvent(event);
21+
22+
expect($mdInteraction.getLastInteractionType()).toBe("mouse");
23+
}));
1524

1625
});
1726
});

0 commit comments

Comments
 (0)