forked from 15001217168/mojs
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathparse-easing.spec.js
More file actions
47 lines (45 loc) · 1.65 KB
/
Copy pathparse-easing.spec.js
File metadata and controls
47 lines (45 loc) · 1.65 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
var helpers = mojs.__helpers__;
var parseEasing = helpers.parseEasing;
describe('parse-easing ->', function() {
it('should parse function easing', function() {
var fun;
fun = function() {};
expect(parseEasing(fun)).toBe(fun);
expect(typeof parseEasing(fun)).toBe('function');
});
it('should parse null/undefined to liner.none', function() {
var fun;
fun = parseEasing();
expect(fun).toBe(mojs.easing.sin.out);
});
describe('easing name option ->', function() {
it('should parse string easing', function() {
expect(parseEasing('cubic.in')).toBe(mojs.easing.cubic.in);
});
it('should error if easing was not found and fallback to linear one', function() {
var fun;
spyOn(console, 'error');
fun = parseEasing('sinusoidal.in');
expect(console.error).toHaveBeenCalled();
expect(typeof console.error.calls.mostRecent().args[0]).toBe('string');
expect(console.error.calls.mostRecent().args[1]).toBe(mojs.easing);
expect(fun).toBe(mojs.easing.sin.out);
});
describe('SVG path option ->', function() {
it('should parse SVG path easing', function() {
expect(typeof parseEasing('M0,100 L100,0')).toBe('function');
});
});
// not yet
// describe('bezier option ->', function() {
// it('should parse bezier easing', function() {
// expect(typeof parseEasing([0.42, 0, 1, 1])).toBe('function');
// });
// it('should call bezier method', function() {
// spyOn(window.mojs.easing, 'bezier');
// parseEasing([0.42, 0, 1, 1]);
// expect(window.mojs.easing.bezier).toHaveBeenCalled();
// });
// });
});
});