@@ -8,124 +8,76 @@ describe('getTabIndex', () => {
8
8
describe ( 'as a number ' , ( ) => {
9
9
describe ( 'zero' , ( ) => {
10
10
it ( 'should return zero' , ( ) => {
11
- expect (
12
- getTabIndex (
13
- JSXAttributeMock ( 'tabIndex' , 0 ) ,
14
- ) ,
15
- ) . toBe ( 0 ) ;
11
+ expect ( getTabIndex ( JSXAttributeMock ( 'tabIndex' , 0 ) ) ) . toBe ( 0 ) ;
16
12
} ) ;
17
13
} ) ;
18
14
describe ( 'positive integer' , ( ) => {
19
15
it ( 'should return the integer' , ( ) => {
20
- expect (
21
- getTabIndex (
22
- JSXAttributeMock ( 'tabIndex' , 1 ) ,
23
- ) ,
24
- ) . toBe ( 1 ) ;
16
+ expect ( getTabIndex ( JSXAttributeMock ( 'tabIndex' , 1 ) ) ) . toBe ( 1 ) ;
25
17
} ) ;
26
18
} ) ;
27
19
describe ( 'negative integer' , ( ) => {
28
20
it ( 'should return the integer' , ( ) => {
29
- expect (
30
- getTabIndex (
31
- JSXAttributeMock ( 'tabIndex' , - 1 ) ,
32
- ) ,
33
- ) . toBe ( - 1 ) ;
21
+ expect ( getTabIndex ( JSXAttributeMock ( 'tabIndex' , - 1 ) ) ) . toBe ( - 1 ) ;
34
22
} ) ;
35
23
} ) ;
36
24
describe ( 'float' , ( ) => {
37
25
it ( 'should return undefined' , ( ) => {
38
- expect (
39
- getTabIndex (
40
- JSXAttributeMock ( 'tabIndex' , 9.1 ) ,
41
- ) ,
42
- ) . toBeUndefined ( ) ;
26
+ expect ( getTabIndex ( JSXAttributeMock ( 'tabIndex' , 9.1 ) ) ) . toBeUndefined ( ) ;
43
27
} ) ;
44
28
} ) ;
45
29
} ) ;
46
30
describe ( 'as a string' , ( ) => {
47
31
describe ( 'empty' , ( ) => {
48
32
it ( 'should return undefined' , ( ) => {
49
- expect (
50
- getTabIndex (
51
- JSXAttributeMock ( 'tabIndex' , '' ) ,
52
- ) ,
53
- ) . toBeUndefined ( ) ;
33
+ expect ( getTabIndex ( JSXAttributeMock ( 'tabIndex' , '' ) ) ) . toBeUndefined ( ) ;
54
34
} ) ;
55
35
} ) ;
56
36
describe ( 'which converts to a number' , ( ) => {
57
37
it ( 'should return an integer' , ( ) => {
58
- expect (
59
- getTabIndex (
60
- JSXAttributeMock ( 'tabIndex' , '0' ) ,
61
- ) ,
62
- ) . toBe ( 0 ) ;
38
+ expect ( getTabIndex ( JSXAttributeMock ( 'tabIndex' , '0' ) ) ) . toBe ( 0 ) ;
63
39
} ) ;
64
40
} ) ;
65
41
describe ( 'which is NaN' , ( ) => {
66
42
it ( 'should return undefined' , ( ) => {
67
- expect (
68
- getTabIndex (
69
- JSXAttributeMock ( 'tabIndex' , '0a' ) ,
70
- ) ,
71
- ) . toBeUndefined ( ) ;
43
+ expect ( getTabIndex ( JSXAttributeMock ( 'tabIndex' , '0a' ) ) ) . toBeUndefined ( ) ;
72
44
} ) ;
73
45
} ) ;
74
46
} ) ;
75
47
describe ( 'as a boolean' , ( ) => {
76
48
describe ( 'true' , ( ) => {
77
49
it ( 'should return undefined' , ( ) => {
78
- expect (
79
- getTabIndex (
80
- JSXAttributeMock ( 'tabIndex' , true ) ,
81
- ) ,
82
- ) . toBeUndefined ( ) ;
50
+ expect ( getTabIndex ( JSXAttributeMock ( 'tabIndex' , true ) ) ) . toBeUndefined ( ) ;
83
51
} ) ;
84
52
} ) ;
85
53
describe ( 'false' , ( ) => {
86
54
it ( 'should return undefined' , ( ) => {
87
- expect (
88
- getTabIndex (
89
- JSXAttributeMock ( 'tabIndex' , false ) ,
90
- ) ,
91
- ) . toBeUndefined ( ) ;
55
+ expect ( getTabIndex ( JSXAttributeMock ( 'tabIndex' , false ) ) ) . toBeUndefined ( ) ;
92
56
} ) ;
93
57
} ) ;
94
58
} ) ;
95
59
describe ( 'as an expression' , ( ) => {
96
60
describe ( 'function expression' , ( ) => {
97
61
it ( 'should return the correct type' , ( ) => {
98
62
const attr = function mockFn ( ) { return 0 ; } ;
99
- expect (
100
- typeof getTabIndex (
101
- JSXAttributeMock ( 'tabIndex' , attr ) ,
102
- ) ,
103
- ) . toEqual ( 'function' ) ;
63
+ expect ( typeof getTabIndex ( JSXAttributeMock ( 'tabIndex' , attr ) ) ) . toEqual ( 'function' ) ;
104
64
} ) ;
105
65
} ) ;
106
66
describe ( 'variable expression' , ( ) => {
107
67
it ( 'should return the Identifier name' , ( ) => {
108
68
const name = 'identName' ;
109
- expect (
110
- getTabIndex (
111
- JSXAttributeMock (
112
- 'tabIndex' ,
113
- IdentifierMock ( name ) ,
114
- true ,
115
- ) ,
116
- ) ,
117
- ) . toEqual ( name ) ;
69
+ expect ( getTabIndex ( JSXAttributeMock (
70
+ 'tabIndex' ,
71
+ IdentifierMock ( name ) ,
72
+ true ,
73
+ ) ) ) . toEqual ( name ) ;
118
74
} ) ;
119
75
} ) ;
120
76
} ) ;
121
77
} ) ;
122
78
describe ( 'tabIndex is not defined' , ( ) => {
123
79
it ( 'should return undefined' , ( ) => {
124
- expect (
125
- getTabIndex (
126
- JSXAttributeMock ( 'tabIndex' , undefined ) ,
127
- ) ,
128
- ) . toBeUndefined ( ) ;
80
+ expect ( getTabIndex ( JSXAttributeMock ( 'tabIndex' , undefined ) ) ) . toBeUndefined ( ) ;
129
81
} ) ;
130
82
} ) ;
131
83
} ) ;
0 commit comments