forked from react-bootstrap/react-bootstrap
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTabSpec.js
More file actions
54 lines (44 loc) · 1.64 KB
/
TabSpec.js
File metadata and controls
54 lines (44 loc) · 1.64 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
import React from 'react';
import ReactTestUtils from 'react-addons-test-utils';
import ReactDOM from 'react-dom';
import Tab from '../src/Tab';
describe('<Tab>', () => {
it('Should have class', () => {
let instance = ReactTestUtils.renderIntoDocument(
<Tab>Item content</Tab>
);
assert.ok(ReactTestUtils.findRenderedDOMComponentWithClass(instance, 'tab-pane'));
});
it('Should add active class', () => {
let instance = ReactTestUtils.renderIntoDocument(
<Tab>Item content</Tab>
);
assert.ok(ReactTestUtils.findRenderedDOMComponentWithClass(instance, 'active'));
});
it('Should not add active class when not visible', () => {
let instance = ReactTestUtils.renderIntoDocument(
<Tab eventKey={{}}>Item content</Tab>
);
assert.lengthOf(ReactTestUtils.scryRenderedDOMComponentsWithClass(instance, 'active'), 0);
});
describe('Web Accessibility', () => {
it('Should have aria-hidden false when visible', () => {
let instance = ReactTestUtils.renderIntoDocument(
<Tab>Item content</Tab>
);
assert.equal(ReactDOM.findDOMNode(instance).getAttribute('aria-hidden'), 'false');
});
it('Should have aria-hidden true when hidden', () => {
let instance = ReactTestUtils.renderIntoDocument(
<Tab eventKey={{}}>Item content</Tab>
);
assert.equal(ReactDOM.findDOMNode(instance).getAttribute('aria-hidden'), 'true');
});
it('Should have role', () => {
let instance = ReactTestUtils.renderIntoDocument(
<Tab>Item content</Tab>
);
assert.equal(ReactDOM.findDOMNode(instance).getAttribute('role'), 'tabpanel');
});
});
});