mirror of
https://github.com/apache/superset.git
synced 2026-04-19 08:04:53 +00:00
feat(listview): set default view mode based on THUMBNAIL feature flag (#10691)
* feat(listview): set default view mode based on THUMBNAIL feature flag * add spec * better generic typing for ListView * lint * fix specs
This commit is contained in:
@@ -292,13 +292,13 @@ describe('ListView', () => {
|
||||
);
|
||||
});
|
||||
|
||||
it('disable card view based on prop', async () => {
|
||||
it('disables card view based on prop', async () => {
|
||||
expect(wrapper.find(CardCollection).exists()).toBe(false);
|
||||
expect(wrapper.find(CardSortSelect).exists()).toBe(false);
|
||||
expect(wrapper.find(TableCollection).exists()).toBe(true);
|
||||
});
|
||||
|
||||
it('enable card view based on prop', async () => {
|
||||
it('enables card view based on prop', async () => {
|
||||
const wrapper2 = factory({
|
||||
...mockedProps,
|
||||
renderCard: jest.fn(),
|
||||
@@ -310,6 +310,26 @@ describe('ListView', () => {
|
||||
expect(wrapper2.find(TableCollection).exists()).toBe(false);
|
||||
});
|
||||
|
||||
it('allows setting the default view mode', async () => {
|
||||
const wrapper2 = factory({
|
||||
...mockedProps,
|
||||
renderCard: jest.fn(),
|
||||
defaultViewMode: 'card',
|
||||
initialSort: [{ id: 'something' }],
|
||||
});
|
||||
await waitForComponentToPaint(wrapper2);
|
||||
expect(wrapper2.find(CardCollection).exists()).toBe(true);
|
||||
|
||||
const wrapper3 = factory({
|
||||
...mockedProps,
|
||||
renderCard: jest.fn(),
|
||||
defaultViewMode: 'table',
|
||||
initialSort: [{ id: 'something' }],
|
||||
});
|
||||
await waitForComponentToPaint(wrapper3);
|
||||
expect(wrapper3.find(TableCollection).exists()).toBe(true);
|
||||
});
|
||||
|
||||
it('Throws an exception if filter missing in columns', () => {
|
||||
expect.assertions(1);
|
||||
const props = {
|
||||
|
||||
Reference in New Issue
Block a user