-
Notifications
You must be signed in to change notification settings - Fork 56
Expand file tree
/
Copy pathmouse.position.test.ts
More file actions
49 lines (41 loc) · 1.31 KB
/
mouse.position.test.ts
File metadata and controls
49 lines (41 loc) · 1.31 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
import { getMousePosition } from "./mouse.position";
describe("getMousePosition", () => {
const layout = {
allDayRowBottom: 100,
allDayRowTop: 50,
gridYStart: 150,
sidebarXStart: 200,
};
it("should return false when x is less than sidebarXStart", () => {
const result = getMousePosition(layout, { x: 100, y: 100 });
expect(result).toEqual({
isOverGrid: false,
isOverMainGrid: false,
isOverAllDayRow: false,
});
});
it("should return isOverAllDayRow as true when y is between allDayRowTop and allDayRowBottom", () => {
const result = getMousePosition(layout, { x: 250, y: 75 });
expect(result).toEqual({
isOverGrid: true,
isOverMainGrid: false,
isOverAllDayRow: true,
});
});
it("should return isOverMainGrid as true when y is greater than gridYStart", () => {
const result = getMousePosition(layout, { x: 250, y: 200 });
expect(result).toEqual({
isOverGrid: true,
isOverMainGrid: true,
isOverAllDayRow: false,
});
});
it("should return isOverGrid as false when y is less than allDayRowTop and gridYStart", () => {
const result = getMousePosition(layout, { x: 250, y: 25 });
expect(result).toEqual({
isOverGrid: false,
isOverMainGrid: false,
isOverAllDayRow: false,
});
});
});