mirror of
https://github.com/getredash/redash.git
synced 2026-03-23 04:00:09 -04:00
36 lines
855 B
JavaScript
36 lines
855 B
JavaScript
import React from 'react';
|
|
import enzyme from 'enzyme';
|
|
|
|
import Column from './datetime';
|
|
|
|
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 -> Date/Time', () => {
|
|
describe('Editor', () => {
|
|
test('Changes format', (done) => {
|
|
const el = mount({
|
|
name: 'a',
|
|
dateTimeFormat: 'YYYY-MM-DD HH:mm:ss',
|
|
}, done);
|
|
|
|
findByTestID(el, 'Table.ColumnEditor.DateTime.Format').last().find('input')
|
|
.simulate('change', { target: { value: 'YYYY/MM/DD HH:ss' } });
|
|
});
|
|
});
|
|
});
|