forked from alibaba-fusion/next
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patha11y-spec.js
More file actions
61 lines (52 loc) · 1.71 KB
/
a11y-spec.js
File metadata and controls
61 lines (52 loc) · 1.71 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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
import React from 'react';
import Enzyme from 'enzyme';
import Adapter from 'enzyme-adapter-react-16';
import {
test,
testReact,
unmount,
createContainer,
} from '../util/a11y/validate';
import SplitButton from '../../src/split-button';
import '../../src/split-button/style.js';
Enzyme.configure({ adapter: new Adapter() });
const portalContainerId = 'a11y-portal-id';
/* eslint-disable no-undef, react/jsx-filename-extension */
// TODO: `button-name` - add label for down arrow button
describe.skip('SplitButton A11y', () => {
let wrapper;
let portalContainer;
const menu = ['a', 'b'].map(item => (
<SplitButton.Item key={item}>{item}</SplitButton.Item>
));
afterEach(() => {
if (wrapper) {
wrapper.unmount();
wrapper = null;
}
if (portalContainer) {
portalContainer.remove();
}
unmount();
});
it('should not have any violations when menu NOT visible', async () => {
portalContainer = createContainer(portalContainerId);
const popupProps = { container: portalContainer };
wrapper = await testReact(
<SplitButton label="hello world" popupProps={popupProps}>
{menu}
</SplitButton>
);
return test(portalContainer);
});
it('should not have any violations when menu visible', async () => {
portalContainer = createContainer(portalContainerId);
const popupProps = { container: portalContainer };
wrapper = await testReact(
<SplitButton label="hello world" popupProps={popupProps} visible>
{menu}
</SplitButton>
);
return test(portalContainer);
});
});