forked from Availity/availity-reactstrap-validation
-
Notifications
You must be signed in to change notification settings - Fork 0
/
AvFeedback.spec.js
43 lines (35 loc) · 1.06 KB
/
AvFeedback.spec.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
import React from 'react';
import { shallow } from 'enzyme';
import { AvFeedback } from 'availity-reactstrap-validation';
import { FormFeedback } from 'reactstrap';
const state = {};
const options = {
context: {
FormCtrl: {},
Group: {
getInputState: () => state,
},
},
};
describe('AvFeedback', () => {
describe('when there is an error', () => {
beforeEach(() => {
state.color = 'danger';
});
it('should render with "FormFeedback"', () => {
const wrapper = shallow(<AvFeedback>Yo!</AvFeedback>, options);
expect(wrapper.type()).to.equal(FormFeedback);
});
it('should render children inside the FormFeedback', () => {
const wrapper = shallow(<AvFeedback>Yo!</AvFeedback>, options);
expect(wrapper.prop('children')).to.equal('Yo!');
});
it('should render with the props passed in', () => {
const wrapper = shallow(
<AvFeedback style={{ textAlign: 'center' }}>Yo!</AvFeedback>,
options
);
expect(wrapper.prop('style').textAlign).to.equal('center');
});
});
});