forked from react-bootstrap/react-bootstrap
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathControlLabelSpec.js
More file actions
56 lines (49 loc) · 1.23 KB
/
ControlLabelSpec.js
File metadata and controls
56 lines (49 loc) · 1.23 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
import React from 'react';
import $ from 'teaspoon';
import ControlLabel from '../src/ControlLabel';
import FormGroup from '../src/FormGroup';
import { shouldWarn } from './helpers';
describe('<ControlLabel>', () => {
it('should render correctly', () => {
expect(
$(
<ControlLabel htmlFor="foo" className="my-control-label">
Label
</ControlLabel>
)
.shallowRender()
.single('label.control-label.my-control-label[htmlFor="foo"]')
.text()
).to.equal('Label');
});
it('should respect srOnly', () => {
$(
<ControlLabel srOnly>
Label
</ControlLabel>
)
.shallowRender()
.single('label.control-label.sr-only');
});
it('should use controlId for htmlFor', () => {
$(
<FormGroup controlId="foo">
<ControlLabel>Label</ControlLabel>
</FormGroup>
)
.render()
.single('label.control-label[htmlFor="foo"]');
});
it('should prefer explicit htmlFor', () => {
shouldWarn('ignored');
$(
<FormGroup controlId="foo">
<ControlLabel htmlFor="bar">
Label
</ControlLabel>
</FormGroup>
)
.render()
.single('label.control-label[htmlFor="bar"]');
});
});