-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathLabelSpec.js
35 lines (30 loc) · 1.05 KB
/
LabelSpec.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
import React from 'react';
import ReactDOM from 'react-dom';
import ReactTestUtils from 'react-dom/test-utils';
import Label from '../src/Label';
describe('Label', () => {
it('Should output a label with message', () => {
let instance = ReactTestUtils.renderIntoDocument(
<Label>
<strong>Message</strong>
</Label>
);
assert.ok(
ReactTestUtils.findRenderedDOMComponentWithTag(instance, 'strong')
);
});
it('Should have bsClass by default', () => {
let instance = ReactTestUtils.renderIntoDocument(<Label>Message</Label>);
assert.ok(ReactDOM.findDOMNode(instance).className.match(/\blabel\b/));
});
it('Should have bsStyle by default', () => {
let instance = ReactTestUtils.renderIntoDocument(<Label>Message</Label>);
assert.ok(
ReactDOM.findDOMNode(instance).className.match(/\blabel-default\b/)
);
});
it('Hides when empty', () => {
let instance = ReactTestUtils.renderIntoDocument(<Label />);
assert.ok(ReactDOM.findDOMNode(instance).className.match(/\bhidden\b/));
});
});