mirror of
https://github.com/ansible/awx.git
synced 2026-01-15 03:40:42 -03:30
Fix linter errors and add test to AnsibleSelect component.
This commit is contained in:
parent
97477b789a
commit
2b18cee9c0
@ -41,4 +41,16 @@ describe('<AnsibleSelect />', () => {
|
||||
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(
|
||||
<AnsibleSelect
|
||||
selected="foo"
|
||||
selectChange={() => { }}
|
||||
labelName={label}
|
||||
data={mockData}
|
||||
defaultSelected={mockData[1]}
|
||||
/>
|
||||
);
|
||||
expect(wrapper.find('Select')).toHaveLength(1);
|
||||
});
|
||||
});
|
||||
|
||||
@ -39,9 +39,8 @@ class AnsibleSelect extends React.Component {
|
||||
<FormGroup label={labelName} fieldId="ansible-select">
|
||||
<Select value={selected} onChange={this.onSelectChange} aria-label="Select Input">
|
||||
<SelectOption isDisabled key="" value="" label={`Use Default ${labelName}`} />
|
||||
{data.map((datum) =>
|
||||
datum !== defaultSelected ?
|
||||
(<SelectOption key={datum} value={datum} label={datum} />) : null)
|
||||
{data.map((datum) => (datum !== defaultSelected
|
||||
? (<SelectOption key={datum} value={datum} label={datum} />) : null))
|
||||
}
|
||||
</Select>
|
||||
</FormGroup>
|
||||
|
||||
@ -40,7 +40,7 @@ class OrganizationAdd extends React.Component {
|
||||
this.onCancel = this.onCancel.bind(this);
|
||||
this.updateSelectedInstanceGroups = this.updateSelectedInstanceGroups.bind(this);
|
||||
}
|
||||
|
||||
|
||||
state = {
|
||||
name: '',
|
||||
description: '',
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user