Skip to content

Commit 356944a

Browse files
committed
Upgrade dependencies.
1 parent d700045 commit 356944a

35 files changed

+294
-468
lines changed

__mocks__/genInteractives.js

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -142,8 +142,8 @@ export function genElementSymbol(openingElement: Object) {
142142
openingElement.name.name +
143143
(openingElement.attributes.length > 0
144144
? `${openingElement.attributes
145-
.map(attr => `[${attr.name.name}="${attr.value.value}"]`)
146-
.join('')}`
145+
.map(attr => `[${attr.name.name}="${attr.value.value}"]`)
146+
.join('')}`
147147
: '')
148148
);
149149
}
@@ -156,16 +156,14 @@ export function genInteractiveElements() {
156156
name = elementSymbol.slice(0, bracketIndex);
157157
}
158158
const attributes = interactiveElementsMap[elementSymbol].map(({ prop, value }) =>
159-
JSXAttributeMock(prop, value),
160-
);
159+
JSXAttributeMock(prop, value));
161160
return JSXElementMock(name, attributes);
162161
});
163162
}
164163

165164
export function genInteractiveRoleElements() {
166165
return [...interactiveRoles, 'button article', 'fakerole button article'].map(value =>
167-
JSXElementMock('div', [JSXAttributeMock('role', value)]),
168-
);
166+
JSXElementMock('div', [JSXAttributeMock('role', value)]));
169167
}
170168

171169
export function genNonInteractiveElements() {
@@ -176,16 +174,14 @@ export function genNonInteractiveElements() {
176174
name = elementSymbol.slice(0, bracketIndex);
177175
}
178176
const attributes = nonInteractiveElementsMap[elementSymbol].map(({ prop, value }) =>
179-
JSXAttributeMock(prop, value),
180-
);
177+
JSXAttributeMock(prop, value));
181178
return JSXElementMock(name, attributes);
182179
});
183180
}
184181

185182
export function genNonInteractiveRoleElements() {
186183
return [...nonInteractiveRoles, 'article button', 'fakerole article button'].map(value =>
187-
JSXElementMock('div', [JSXAttributeMock('role', value)]),
188-
);
184+
JSXElementMock('div', [JSXAttributeMock('role', value)]));
189185
}
190186

191187
export function genAbstractRoleElements() {
@@ -199,8 +195,7 @@ export function genNonAbstractRoleElements() {
199195
export function genIndeterminantInteractiveElements() {
200196
return Object.keys(indeterminantInteractiveElementsMap).map((name) => {
201197
const attributes = indeterminantInteractiveElementsMap[name].map(({ prop, value }) =>
202-
JSXAttributeMock(prop, value),
203-
);
198+
JSXAttributeMock(prop, value));
204199
return JSXElementMock(name, attributes);
205200
});
206201
}

__tests__/__util__/parserOptionsMapper.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ const defaultParserOptions = {
88
export default function parserOptionsMapper({
99
code,
1010
errors,
11-
options,
11+
options = [],
1212
parserOptions = {},
1313
}) {
1414
return {

__tests__/__util__/ruleOptionsMapperFactory.js

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,23 +4,14 @@
44

55
type ESLintTestRunnerTestCase = {
66
code: string,
7-
errors: ?Array<{
8-
message: string,
9-
type: string,
10-
}>,
7+
errors: ?Array<{ message: string, type: string }>,
118
options: ?Array<mixed>,
12-
parserOptions: ?Array<mixed>,
9+
parserOptions: ?Array<mixed>
1310
};
1411

15-
export default function ruleOptionsMapperFactory(
16-
ruleOptions: Array<mixed> = [],
17-
) {
18-
return ({
19-
code,
20-
errors,
21-
options,
22-
parserOptions,
23-
}: ESLintTestRunnerTestCase): ESLintTestRunnerTestCase => ({
12+
export default function ruleOptionsMapperFactory(ruleOptions: Array<mixed> = []) {
13+
// eslint-disable-next-line
14+
return ({ code, errors, options, parserOptions }: ESLintTestRunnerTestCase): ESLintTestRunnerTestCase => ({
2415
code,
2516
errors,
2617
options: (options || []).concat(ruleOptions),

__tests__/src/rules/aria-role-test.js

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,8 @@ const errorMessage = {
2626

2727
const roleKeys = [...roles.keys()];
2828

29-
const validRoles = roleKeys.filter(
30-
role => roles.get(role).abstract === false,
31-
);
32-
const invalidRoles = roleKeys.filter(
33-
role => roles.get(role).abstract === true,
34-
);
29+
const validRoles = roleKeys.filter(role => roles.get(role).abstract === false);
30+
const invalidRoles = roleKeys.filter(role => roles.get(role).abstract === true);
3531

3632
const createTests = roleNames => roleNames.map(role => ({
3733
code: `<div role="${role.toLowerCase()}" />`,

__tests__/src/rules/interactive-supports-focus-test.js

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -175,10 +175,7 @@ const passReducer = (roles, handlers, messageTemplate) =>
175175
roleAcc.concat(handlers
176176
.map(handler => ({
177177
code: messageTemplate(element, role, handler),
178-
}),
179-
),
180-
), []),
181-
), []);
178+
}))), [])), []);
182179

183180
const failReducer = (roles, handlers, messageTemplate) =>
184181
staticElements.reduce((elementAcc, element) =>
@@ -190,10 +187,7 @@ const failReducer = (roles, handlers, messageTemplate) =>
190187
type,
191188
message: messageTemplate(role),
192189
}],
193-
}),
194-
),
195-
), []),
196-
), []);
190+
}))), [])), []);
197191

198192
ruleTester.run(`${ruleName}:recommended`, rule, {
199193
valid: [

__tests__/src/util/getTabIndex-test.js

Lines changed: 16 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -8,124 +8,76 @@ describe('getTabIndex', () => {
88
describe('as a number ', () => {
99
describe('zero', () => {
1010
it('should return zero', () => {
11-
expect(
12-
getTabIndex(
13-
JSXAttributeMock('tabIndex', 0),
14-
),
15-
).toBe(0);
11+
expect(getTabIndex(JSXAttributeMock('tabIndex', 0))).toBe(0);
1612
});
1713
});
1814
describe('positive integer', () => {
1915
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);
2517
});
2618
});
2719
describe('negative integer', () => {
2820
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);
3422
});
3523
});
3624
describe('float', () => {
3725
it('should return undefined', () => {
38-
expect(
39-
getTabIndex(
40-
JSXAttributeMock('tabIndex', 9.1),
41-
),
42-
).toBeUndefined();
26+
expect(getTabIndex(JSXAttributeMock('tabIndex', 9.1))).toBeUndefined();
4327
});
4428
});
4529
});
4630
describe('as a string', () => {
4731
describe('empty', () => {
4832
it('should return undefined', () => {
49-
expect(
50-
getTabIndex(
51-
JSXAttributeMock('tabIndex', ''),
52-
),
53-
).toBeUndefined();
33+
expect(getTabIndex(JSXAttributeMock('tabIndex', ''))).toBeUndefined();
5434
});
5535
});
5636
describe('which converts to a number', () => {
5737
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);
6339
});
6440
});
6541
describe('which is NaN', () => {
6642
it('should return undefined', () => {
67-
expect(
68-
getTabIndex(
69-
JSXAttributeMock('tabIndex', '0a'),
70-
),
71-
).toBeUndefined();
43+
expect(getTabIndex(JSXAttributeMock('tabIndex', '0a'))).toBeUndefined();
7244
});
7345
});
7446
});
7547
describe('as a boolean', () => {
7648
describe('true', () => {
7749
it('should return undefined', () => {
78-
expect(
79-
getTabIndex(
80-
JSXAttributeMock('tabIndex', true),
81-
),
82-
).toBeUndefined();
50+
expect(getTabIndex(JSXAttributeMock('tabIndex', true))).toBeUndefined();
8351
});
8452
});
8553
describe('false', () => {
8654
it('should return undefined', () => {
87-
expect(
88-
getTabIndex(
89-
JSXAttributeMock('tabIndex', false),
90-
),
91-
).toBeUndefined();
55+
expect(getTabIndex(JSXAttributeMock('tabIndex', false))).toBeUndefined();
9256
});
9357
});
9458
});
9559
describe('as an expression', () => {
9660
describe('function expression', () => {
9761
it('should return the correct type', () => {
9862
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');
10464
});
10565
});
10666
describe('variable expression', () => {
10767
it('should return the Identifier name', () => {
10868
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);
11874
});
11975
});
12076
});
12177
});
12278
describe('tabIndex is not defined', () => {
12379
it('should return undefined', () => {
124-
expect(
125-
getTabIndex(
126-
JSXAttributeMock('tabIndex', undefined),
127-
),
128-
).toBeUndefined();
80+
expect(getTabIndex(JSXAttributeMock('tabIndex', undefined))).toBeUndefined();
12981
});
13082
});
13183
});

__tests__/src/util/hasAccessibleChild-test.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,7 @@ import JSXExpressionContainerMock from '../../../__mocks__/JSXExpressionContaine
77
describe('hasAccessibleChild', () => {
88
describe('has no children and does not set dangerouslySetInnerHTML', () => {
99
it('returns false', () => {
10-
expect(
11-
hasAccessibleChild(JSXElementMock('div', [])),
12-
).toBe(false);
10+
expect(hasAccessibleChild(JSXElementMock('div', []))).toBe(false);
1311
});
1412
});
1513

__tests__/src/util/isAbstractRole-test.js

Lines changed: 18 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -16,29 +16,25 @@ describe('isAbstractRole', () => {
1616
});
1717
});
1818
describe('elements with an abstract role', () => {
19-
genAbstractRoleElements().forEach(
20-
({ openingElement }) => {
21-
const attributes = openingElement.attributes;
22-
it(`should identify \`${genElementSymbol(openingElement)}\` as an abstract role element`, () => {
23-
expect(isAbstractRole(
24-
elementType(openingElement),
25-
attributes,
26-
)).toBe(true);
27-
});
28-
},
29-
);
19+
genAbstractRoleElements().forEach(({ openingElement }) => {
20+
const { attributes } = openingElement;
21+
it(`should identify \`${genElementSymbol(openingElement)}\` as an abstract role element`, () => {
22+
expect(isAbstractRole(
23+
elementType(openingElement),
24+
attributes,
25+
)).toBe(true);
26+
});
27+
});
3028
});
3129
describe('elements with a non-abstract role', () => {
32-
genNonAbstractRoleElements().forEach(
33-
({ openingElement }) => {
34-
const attributes = openingElement.attributes;
35-
it(`should NOT identify \`${genElementSymbol(openingElement)}\` as an abstract role element`, () => {
36-
expect(isAbstractRole(
37-
elementType(openingElement),
38-
attributes,
39-
)).toBe(false);
40-
});
41-
},
42-
);
30+
genNonAbstractRoleElements().forEach(({ openingElement }) => {
31+
const { attributes } = openingElement;
32+
it(`should NOT identify \`${genElementSymbol(openingElement)}\` as an abstract role element`, () => {
33+
expect(isAbstractRole(
34+
elementType(openingElement),
35+
attributes,
36+
)).toBe(false);
37+
});
38+
});
4339
});
4440
});

0 commit comments

Comments
 (0)