Files
redash/client/app/visualizations/table/Editor/GridSettings.test.js
Levko Kravets 7157244eec Migrate Table visualization to React Part 2: Editor (#4175)
* Migrate table editor to React: skeleton, Grid tab

* Columns tab

* Cleanup

* Columns tab: DnD column sorting

* Columns types should be JSX

* New Columns tab UI/X

* Use Sortable component on Columns tab

* Tests: Grid Settings

* Tests: Columns Settings

* Tests: Editors for Text, Number, Boolean and Date/Time columns

* Tests: Editors for Image and Link columns

* Minor UI fix

* Trigger build

* Debounce inputs
2019-10-24 12:46:46 +03:00

37 lines
931 B
JavaScript

import React from 'react';
import enzyme from 'enzyme';
import getOptions from '../getOptions';
import GridSettings from './GridSettings';
function findByTestID(wrapper, testId) {
return wrapper.find(`[data-test="${testId}"]`);
}
function mount(options, done) {
const data = { columns: [], rows: [] };
options = getOptions(options, data);
return enzyme.mount((
<GridSettings
visualizationName="Test"
data={data}
options={options}
onOptionsChange={(changedOptions) => {
expect(changedOptions).toMatchSnapshot();
done();
}}
/>
));
}
describe('Visualizations -> Table -> Editor -> Grid Settings', () => {
test('Changes items per page', (done) => {
const el = mount({
itemsPerPage: 25,
}, done);
findByTestID(el, 'Table.ItemsPerPage').first().simulate('click');
findByTestID(el, 'Table.ItemsPerPage.100').first().simulate('click');
});
});