Fetch Targets after component is mounted (#1362)

This commit is contained in:
Kyle Knight 2017-03-07 10:27:29 -08:00 committed by Jason Meller
parent 13f06904ee
commit 95b9e2c7d5
2 changed files with 2 additions and 6 deletions

View File

@ -39,9 +39,9 @@ class SelectTargetsDropdown extends Component {
}
componentWillMount () {
this.fetchTargets();
this.mounted = true;
this.wrapperHeight = 0;
this.fetchTargets();
return false;
}

View File

@ -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) => {