chore(home-screen): fixes for loading states, flicker issue, and reduction of api calls (#11557)

* fixes for loading states, flicker issue, api calls

* fix filter bug

* add high res images

* bug fixes for cards and face pile, change imgs to svgs, and address comments

* update from comments

* add stopprop

* fix tests

* add liscenses

* remove unused type

* fix types

* add license

* fix lint
This commit is contained in:
Phillip Kelley-Dotson
2020-11-06 22:35:13 -05:00
committed by GitHub
parent a6bf95e30b
commit d8373f2bb9
30 changed files with 730 additions and 324 deletions

View File

@@ -74,11 +74,22 @@ describe('SavedQueries', () => {
user: {
userId: '1',
},
mine: mockqueries,
};
const wrapper = mount(<SavedQueries {...savedQueryProps} />, {
context: { store },
});
const clickTab = (idx: number) => {
act(() => {
const handler = wrapper.find('li.no-router a').at(idx).prop('onClick');
if (handler) {
handler({} as any);
}
});
};
beforeAll(async () => {
await waitForComponentToPaint(wrapper);
});
@@ -87,20 +98,19 @@ describe('SavedQueries', () => {
expect(wrapper.find(SavedQueries)).toExist();
});
it('fetches queries favorites and renders listviewcard cards', async () => {
clickTab(0);
await waitForComponentToPaint(wrapper);
expect(fetchMock.calls(/saved_query\/\?q/)).toHaveLength(1);
expect(wrapper.find('ListViewCard')).toExist();
});
it('it renders a submenu with clickable tables and buttons', async () => {
expect(wrapper.find(SubMenu)).toExist();
expect(wrapper.find('li')).toHaveLength(2);
expect(wrapper.find('button')).toHaveLength(2);
act(() => {
wrapper.find('li').at(1).simulate('click');
});
clickTab(1);
await waitForComponentToPaint(wrapper);
expect(fetchMock.calls(/saved_query\/\?q/)).toHaveLength(1);
});
it('fetches queries favorites and renders listviewcard cards', () => {
expect(fetchMock.calls(/saved_query\/\?q/)).toHaveLength(1);
expect(wrapper.find('ListViewCard')).toExist();
expect(fetchMock.calls(/saved_query\/\?q/)).toHaveLength(2);
});
});