mirror of
https://github.com/empayre/fleet.git
synced 2024-11-06 17:05:18 +00:00
Fetch Targets after component is mounted (#1362)
This commit is contained in:
parent
13f06904ee
commit
95b9e2c7d5
@ -39,9 +39,9 @@ class SelectTargetsDropdown extends Component {
|
||||
}
|
||||
|
||||
componentWillMount () {
|
||||
this.fetchTargets();
|
||||
this.mounted = true;
|
||||
this.wrapperHeight = 0;
|
||||
this.fetchTargets();
|
||||
|
||||
return false;
|
||||
}
|
||||
|
@ -99,8 +99,6 @@ describe('SelectTargetsDropdown - component', () => {
|
||||
afterEach(() => restoreSpies());
|
||||
|
||||
it('calls the api', () => {
|
||||
nock.cleanAll();
|
||||
|
||||
const request = Test.Mocks.targetMock(defaultParams, apiResponseWithTargets);
|
||||
const Component = mount(<SelectTargetsDropdown {...defaultProps} />);
|
||||
const node = Component.node;
|
||||
@ -112,8 +110,6 @@ describe('SelectTargetsDropdown - component', () => {
|
||||
});
|
||||
|
||||
it('calls the onFetchTargets prop', () => {
|
||||
nock.cleanAll();
|
||||
|
||||
const onFetchTargets = createSpy();
|
||||
const props = { ...defaultProps, onFetchTargets };
|
||||
const Component = mount(<SelectTargetsDropdown {...props} />);
|
||||
@ -158,7 +154,7 @@ describe('SelectTargetsDropdown - component', () => {
|
||||
const Component = mount(<SelectTargetsDropdown {...defaultProps} />);
|
||||
const node = Component.node;
|
||||
|
||||
Test.Mocks.targetMock(defaultParams);
|
||||
Test.Mocks.targetMock({ ...defaultParams, query });
|
||||
|
||||
return node.fetchTargets(query)
|
||||
.then((q) => {
|
||||
|
Loading…
Reference in New Issue
Block a user