blob: ab9f51c633d7bf87cf16c22d0e78ebc11698c120 (
plain)
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
|
/* globals describe, expect, it */
import { easing } from '../../../src/main.js'
describe('easing', () => {
var easedValues = {
'-': 0.5,
'<>': 0.5,
'>': 0.7071,
'<': 0.2929
}
;[ '-', '<>', '<', '>' ].forEach((el) => {
describe(el, () => {
it('is 0 at 0', () => {
expect(easing[el](0)).toBe(0)
})
it('is 1 at 1', () => {
expect(Math.round(easing[el](1) * 1000) / 1000).toBe(1) // we need to round cause for some reason at some point 1==0.999999999
})
it('is eased at 0.5', () => {
expect(easing[el](0.5)).toBeCloseTo(easedValues[el])
})
})
})
})
|