-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathno-animate.js
104 lines (101 loc) · 2.13 KB
/
no-animate.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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
'use strict';
const rule = require( '../../src/rules/no-animate' );
const RuleTester = require( '../../tools/rule-tester' );
const error = 'Prefer CSS transitions or CSS scroll-behaviour to .animate';
const errorNoScroll = 'Prefer CSS transitions to .animate';
const ruleTester = new RuleTester();
ruleTester.run( 'no-animate', rule, {
valid: [
'animate()',
'[].animate()',
'div.animate()',
'div.animate',
'stop()',
'[].stop()',
'div.stop()',
'div.stop',
'finish()',
'[].finish()',
'div.finish()',
'div.finish',
{
code: '$div.animate({scrollTop: 100})',
options: [ { allowScroll: true } ]
},
{
code: '$div.animate({scrollLeft: 200})',
options: [ { allowScroll: true } ]
},
{
code: '$div.animate({scrollTop: 100, scrollLeft: 200})',
options: [ { allowScroll: true } ]
}
],
invalid: [
{
code: '$("div").animate()',
errors: [ error ]
},
{
code: '$("div").stop()',
errors: [ error ]
},
{
code: '$("div").finish()',
errors: [ error ]
},
{
code: '$div.animate()',
errors: [ error ]
},
{
code: '$div.animate()',
options: [ { allowScroll: true } ],
errors: [ errorNoScroll ]
},
{
code: '$("div").first().animate()',
errors: [ error ]
},
{
code: '$("div").append($("input").animate())',
errors: [ error ]
},
{
code: '$div.animate({scrollTop: 100})',
errors: [ error ]
},
{
code: '$div.animate({scrollTop: 100})',
options: [ { allowScroll: false } ],
errors: [ error ]
},
{
code: '$div.animate({scrollLeft: 200})',
errors: [ error ]
},
{
code: '$div.animate({scrollTop: 100, scrollLeft: 200})',
errors: [ error ]
},
{
code: '$div.animate({scrollTop: 100, width: 300})',
errors: [ error ]
},
{
code: '$div.animate({scrollTop: 100, width: 300})',
options: [ { allowScroll: true } ],
errors: [ errorNoScroll ]
},
{
code: '$("div").stop({scrollTop: 100, scrollLeft: 200})',
options: [ { allowScroll: true } ],
errors: [ errorNoScroll ]
},
{
code: '$("div").finish({scrollTop: 100, scrollLeft: 200})',
options: [ { allowScroll: true } ],
errors: [ errorNoScroll ]
}
]
} );