prefix content error and loading booleans with 'has'

This commit is contained in:
Jake McDermott
2019-06-20 14:37:46 -04:00
parent b21e491075
commit 36d2d03bc7
14 changed files with 125 additions and 125 deletions

View File

@@ -92,16 +92,16 @@ describe('<TemplatesList />', () => {
test('Templates are retrieved from the api and the components finishes loading', async (done) => {
const loadTemplates = jest.spyOn(_TemplatesList.prototype, 'loadTemplates');
const wrapper = mountWithContexts(<TemplatesList />);
await waitForElement(wrapper, 'TemplatesList', (el) => el.state('contentLoading') === true);
await waitForElement(wrapper, 'TemplatesList', (el) => el.state('hasContentLoading') === true);
expect(loadTemplates).toHaveBeenCalled();
await waitForElement(wrapper, 'TemplatesList', (el) => el.state('contentLoading') === false);
await waitForElement(wrapper, 'TemplatesList', (el) => el.state('hasContentLoading') === false);
done();
});
test('handleSelect is called when a template list item is selected', async (done) => {
const handleSelect = jest.spyOn(_TemplatesList.prototype, 'handleSelect');
const wrapper = mountWithContexts(<TemplatesList />);
await waitForElement(wrapper, 'TemplatesList', (el) => el.state('contentLoading') === false);
await waitForElement(wrapper, 'TemplatesList', (el) => el.state('hasContentLoading') === false);
wrapper.find('DataListCheck#select-jobTemplate-1').props().onChange();
expect(handleSelect).toBeCalled();
await waitForElement(wrapper, 'TemplatesList', (el) => el.state('selected').length === 1);
@@ -111,7 +111,7 @@ describe('<TemplatesList />', () => {
test('handleSelectAll is called when a template list item is selected', async (done) => {
const handleSelectAll = jest.spyOn(_TemplatesList.prototype, 'handleSelectAll');
const wrapper = mountWithContexts(<TemplatesList />);
await waitForElement(wrapper, 'TemplatesList', (el) => el.state('contentLoading') === false);
await waitForElement(wrapper, 'TemplatesList', (el) => el.state('hasContentLoading') === false);
wrapper.find('Checkbox#select-all').props().onChange(true);
expect(handleSelectAll).toBeCalled();
await waitForElement(wrapper, 'TemplatesList', (el) => el.state('selected').length === 5);