feat: add more columns and icons to dataset listview (#10043)

This commit is contained in:
ʈᵃᵢ
2020-06-16 17:30:10 -07:00
committed by GitHub
parent 00e6d7d706
commit 8c012f7941
29 changed files with 3226 additions and 212 deletions

View File

@@ -72,7 +72,9 @@ const mockedProps = {
pageSize: 1,
fetchData: jest.fn(() => []),
loading: false,
bulkActions: [{ name: 'do something', onSelect: jest.fn() }],
bulkActions: [
{ key: 'something', name: 'do something', onSelect: jest.fn() },
],
};
const factory = (props = mockedProps) =>
@@ -222,10 +224,9 @@ Array [
it('handles bulk actions on 1 row', () => {
act(() => {
wrapper
.find('input[title="Toggle Row Selected"]')
.at(0)
.prop('onChange')({ target: { value: 'on' } });
wrapper.find('input[id="0"]').at(0).prop('onChange')({
target: { value: 'on' },
});
wrapper
.find('.dropdown-toggle')
@@ -253,10 +254,9 @@ Array [
it('handles bulk actions on all rows', () => {
act(() => {
wrapper
.find('input[title="Toggle All Rows Selected"]')
.at(0)
.prop('onChange')({ target: { value: 'on' } });
wrapper.find('input[id="header-toggle-all"]').at(0).prop('onChange')({
target: { value: 'on' },
});
wrapper
.find('.dropdown-toggle')

View File

@@ -33,10 +33,12 @@ const store = mockStore({});
const datasetsInfoEndpoint = 'glob:*/api/v1/dataset/_info*';
const datasetsOwnersEndpoint = 'glob:*/api/v1/dataset/related/owners*';
const databaseEndpoint = 'glob:*/api/v1/dataset/related/database*';
const datasetsEndpoint = 'glob:*/api/v1/dataset/?*';
const mockdatasets = [...new Array(3)].map((_, i) => ({
changed_by_name: 'user',
kind: ['physical', 'virtual'][Math.floor(Math.random() * 2)],
changed_by_url: 'changed_by_url',
changed_by: 'user',
changed_on: new Date().toISOString(),
@@ -64,6 +66,9 @@ fetchMock.get(datasetsEndpoint, {
result: mockdatasets,
dataset_count: 3,
});
fetchMock.get(databaseEndpoint, {
result: [],
});
describe('DatasetList', () => {
const mockedProps = {};
@@ -92,7 +97,7 @@ describe('DatasetList', () => {
});
it('fetches data', () => {
wrapper.update();
// wrapper.update();
const callsD = fetchMock.calls(/dataset\/\?q/);
expect(callsD).toHaveLength(1);
expect(callsD[0][0]).toMatchInlineSnapshot(