Fetch hosts when a label is clicked in the Host Side Panel (#1124)

This commit is contained in:
Mike Stone 2017-01-30 15:14:15 -05:00 committed by Jason Meller
parent 9468fb3908
commit 1b54ce18ab
2 changed files with 16 additions and 0 deletions

View file

@ -167,6 +167,7 @@ export class ManageHostsPage extends Component {
const { slug } = selectedLabel;
const nextLocation = slug === 'all-hosts' ? MANAGE_HOSTS : `${MANAGE_HOSTS}/${slug}`;
dispatch(hostActions.loadAll());
dispatch(push(nextLocation));
return false;

View file

@ -76,6 +76,21 @@ describe('ManageHostsPage - component', () => {
expect(page.find('QuerySidePanel').length).toEqual(1);
});
it('fetches all hosts when a label is clicked', () => {
const labels = [windowsLabel];
const pageProps = { ...props, labels };
const Page = mount(<ManageHostsPage {...pageProps} />);
const SidePanel = Page.find('HostSidePanel');
spyOn(hostActions, 'loadAll');
expect(hostActions.loadAll).toNotHaveBeenCalled();
SidePanel.find('.panel-group-item__platform--windows').simulate('click');
expect(hostActions.loadAll).toHaveBeenCalled();
});
});
describe('header', () => {