mirror of
https://github.com/getredash/redash.git
synced 2026-03-23 13:00:10 -04:00
* 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
48 lines
1.2 KiB
JavaScript
48 lines
1.2 KiB
JavaScript
import React from 'react';
|
|
import enzyme from 'enzyme';
|
|
|
|
import Column from './text';
|
|
|
|
function findByTestID(wrapper, testId) {
|
|
return wrapper.find(`[data-test="${testId}"]`);
|
|
}
|
|
|
|
function mount(column, done) {
|
|
return enzyme.mount((
|
|
<Column.Editor
|
|
visualizationName="Test"
|
|
column={column}
|
|
onChange={(changedColumn) => {
|
|
expect(changedColumn).toMatchSnapshot();
|
|
done();
|
|
}}
|
|
/>
|
|
));
|
|
}
|
|
|
|
describe('Visualizations -> Table -> Columns -> Text', () => {
|
|
describe('Editor', () => {
|
|
test('Enables HTML content', (done) => {
|
|
const el = mount({
|
|
name: 'a',
|
|
allowHTML: false,
|
|
highlightLinks: false,
|
|
}, done);
|
|
|
|
findByTestID(el, 'Table.ColumnEditor.Text.AllowHTML').first().find('input')
|
|
.simulate('change', { target: { checked: true } });
|
|
});
|
|
|
|
test('Enables highlight links option', (done) => {
|
|
const el = mount({
|
|
name: 'a',
|
|
allowHTML: true,
|
|
highlightLinks: false,
|
|
}, done);
|
|
|
|
findByTestID(el, 'Table.ColumnEditor.Text.HighlightLinks').first().find('input')
|
|
.simulate('change', { target: { checked: true } });
|
|
});
|
|
});
|
|
});
|