-
Notifications
You must be signed in to change notification settings - Fork 1
/
calculate-interaction-new-times.js
57 lines (56 loc) · 1.58 KB
/
calculate-interaction-new-times.js
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
50
51
52
53
54
55
56
57
import { calculateInteractionNewTimes } from 'lib/utility/calendar'
describe('calculateInteractionNewTimes', () => {
it('should return the original time start and end if no interaction', () => {
expect(
calculateInteractionNewTimes({
itemTimeStart: 200,
itemTimeEnd: 300,
dragTime: false,
isDragging: false,
isResizing: false,
resizingEdge: false,
resizeTime: false
})
).toMatchObject([200, 300])
})
it('should calculate new time start and end if being moved', () => {
expect(
calculateInteractionNewTimes({
itemTimeStart: 200,
itemTimeEnd: 300,
dragTime: 192,
isDragging: true,
isResizing: false,
resizingEdge: false,
resizeTime: false
})
).toMatchObject([192, 292])
})
it('should calculate new time start and end if being resized right', () => {
expect(
calculateInteractionNewTimes({
itemTimeStart: 200,
itemTimeEnd: 300,
dragTime: false,
isDragging: false,
isResizing: true,
resizingEdge: 'right',
resizeTime: 250
})
).toMatchObject([200, 250])
})
it('should calculate new time start and end if being resized left', () => {
expect(
calculateInteractionNewTimes({
itemTimeStart: 200,
itemTimeEnd: 300,
dragTime: false,
isDragging: false,
isResizing: true,
resizingEdge: 'left',
resizeTime: 210
})
).toMatchObject([210, 300])
})
xit('the item is moved and snapped to the grid', () => {})
})