-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathno-fade.js
103 lines (94 loc) · 1.82 KB
/
no-fade.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
'use strict';
const rule = require( '../../src/rules/no-fade' );
const RuleTester = require( '../../tools/rule-tester' );
const inError = 'Prefer CSS transitions to .fadeIn';
const outError = 'Prefer CSS transitions to .fadeOut';
const toError = 'Prefer CSS transitions to .fadeTo';
const toggleError = 'Prefer CSS transitions to .fadeToggle';
const ruleTester = new RuleTester();
ruleTester.run( 'no-fade', rule, {
valid: [
'fadeIn()',
'[].fadeIn()',
'div.fadeIn()',
'div.fadeIn',
'fadeOut()',
'[].fadeOut()',
'div.fadeOut()',
'div.fadeOut',
'fadeTo()',
'[].fadeTo()',
'div.fadeTo()',
'div.fadeTo',
'fadeToggle()',
'[].fadeToggle()',
'div.fadeToggle()',
'div.fadeToggle'
],
invalid: [
{
code: '$("div").fadeIn()',
errors: [ inError ]
},
{
code: '$div.fadeIn()',
errors: [ inError ]
},
{
code: '$("div").first().fadeIn()',
errors: [ inError ]
},
{
code: '$("div").append($("input").fadeIn())',
errors: [ inError ]
},
{
code: '$("div").fadeOut()',
errors: [ outError ]
},
{
code: '$div.fadeOut()',
errors: [ outError ]
},
{
code: '$("div").first().fadeOut()',
errors: [ outError ]
},
{
code: '$("div").append($("input").fadeOut())',
errors: [ outError ]
},
{
code: '$("div").fadeTo()',
errors: [ toError ]
},
{
code: '$div.fadeTo()',
errors: [ toError ]
},
{
code: '$("div").first().fadeTo()',
errors: [ toError ]
},
{
code: '$("div").append($("input").fadeTo())',
errors: [ toError ]
},
{
code: '$("div").fadeToggle()',
errors: [ toggleError ]
},
{
code: '$div.fadeToggle()',
errors: [ toggleError ]
},
{
code: '$("div").first().fadeToggle()',
errors: [ toggleError ]
},
{
code: '$("div").append($("input").fadeToggle())',
errors: [ toggleError ]
}
]
} );