update selected to value in AnsibleSelect

This commit is contained in:
John Mitchell
2019-02-13 14:52:11 -05:00
parent de658939c5
commit 35c94e9cd8
2 changed files with 12 additions and 6 deletions

View File

@@ -8,18 +8,21 @@ describe('<AnsibleSelect />', () => {
test('initially renders succesfully', async () => {
mount(
<AnsibleSelect
selected="foo"
value="foo"
name="bar"
onChange={() => { }}
labelName={label}
data={mockData}
/>
);
});
test('calls "onSelectChange" on dropdown select change', () => {
const spy = jest.spyOn(AnsibleSelect.prototype, 'onSelectChange');
const wrapper = mount(
<AnsibleSelect
selected="foo"
value="foo"
name="bar"
onChange={() => { }}
labelName={label}
data={mockData}
@@ -29,10 +32,12 @@ describe('<AnsibleSelect />', () => {
wrapper.find('select').simulate('change');
expect(spy).toHaveBeenCalled();
});
test('content not rendered when data property is falsey', () => {
const wrapper = mount(
<AnsibleSelect
selected="foo"
value="foo"
name="bar"
onChange={() => { }}
labelName={label}
data={null}