-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBreadcrumbSpec.js
56 lines (44 loc) · 1.76 KB
/
BreadcrumbSpec.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
import React from 'react';
import ReactDOM from 'react-dom';
import ReactTestUtils from 'react-dom/test-utils';
import Breadcrumb from '../src/Breadcrumb';
describe('<Breadcrumb>', () => {
it('Should apply id to the wrapper ol element', () => {
let instance = ReactTestUtils.renderIntoDocument(
<Breadcrumb id="custom-id" />
);
let olNode = ReactTestUtils.findRenderedDOMComponentWithTag(instance, 'ol');
assert.equal(olNode.id, 'custom-id');
});
it('Should have breadcrumb class', () => {
let instance = ReactTestUtils.renderIntoDocument(<Breadcrumb />);
let olNode = ReactTestUtils.findRenderedDOMComponentWithTag(instance, 'ol');
assert.include(olNode.className, 'breadcrumb');
});
it('Should have custom classes', () => {
let instance = ReactTestUtils.renderIntoDocument(
<Breadcrumb className="custom-one custom-two" />
);
let olNode = ReactDOM.findDOMNode(
ReactTestUtils.findRenderedComponentWithType(instance, Breadcrumb)
);
let classes = olNode.className;
assert.include(classes, 'breadcrumb');
assert.include(classes, 'custom-one');
assert.include(classes, 'custom-two');
});
it('Should have a navigation role', () => {
let instance = ReactTestUtils.renderIntoDocument(<Breadcrumb />);
let olNode = ReactDOM.findDOMNode(
ReactTestUtils.findRenderedComponentWithType(instance, Breadcrumb)
);
assert.equal(olNode.getAttribute('role'), 'navigation');
});
it('Should have an aria-label in ol', () => {
let instance = ReactTestUtils.renderIntoDocument(<Breadcrumb />);
let olNode = ReactDOM.findDOMNode(
ReactTestUtils.findRenderedComponentWithType(instance, Breadcrumb)
);
assert.equal(olNode.getAttribute('aria-label'), 'breadcrumbs');
});
});