From 2b18cee9c01a729d08d1bf4273c356e5a97ac043 Mon Sep 17 00:00:00 2001 From: kialam Date: Tue, 12 Feb 2019 09:42:41 -0500 Subject: [PATCH] Fix linter errors and add test to AnsibleSelect component. --- __tests__/components/AnsibleSelect.test.jsx | 12 ++++++++++++ src/components/AnsibleSelect/AnsibleSelect.jsx | 5 ++--- src/pages/Organizations/screens/OrganizationAdd.jsx | 2 +- 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/__tests__/components/AnsibleSelect.test.jsx b/__tests__/components/AnsibleSelect.test.jsx index 6b72ed5cc2..d00a96fd9a 100644 --- a/__tests__/components/AnsibleSelect.test.jsx +++ b/__tests__/components/AnsibleSelect.test.jsx @@ -41,4 +41,16 @@ describe('', () => { expect(wrapper.find('FormGroup')).toHaveLength(0); expect(wrapper.find('Select')).toHaveLength(0); }); + test('Returns correct select options if defaultSelected props is passed', () => { + const wrapper = mount( + { }} + labelName={label} + data={mockData} + defaultSelected={mockData[1]} + /> + ); + expect(wrapper.find('Select')).toHaveLength(1); + }); }); diff --git a/src/components/AnsibleSelect/AnsibleSelect.jsx b/src/components/AnsibleSelect/AnsibleSelect.jsx index ef5df6ba39..e8382ad62e 100644 --- a/src/components/AnsibleSelect/AnsibleSelect.jsx +++ b/src/components/AnsibleSelect/AnsibleSelect.jsx @@ -39,9 +39,8 @@ class AnsibleSelect extends React.Component { diff --git a/src/pages/Organizations/screens/OrganizationAdd.jsx b/src/pages/Organizations/screens/OrganizationAdd.jsx index 04acfe57b3..27558e2757 100644 --- a/src/pages/Organizations/screens/OrganizationAdd.jsx +++ b/src/pages/Organizations/screens/OrganizationAdd.jsx @@ -40,7 +40,7 @@ class OrganizationAdd extends React.Component { this.onCancel = this.onCancel.bind(this); this.updateSelectedInstanceGroups = this.updateSelectedInstanceGroups.bind(this); } - + state = { name: '', description: '',