Files
redash/client/app/visualizations/table/Editor/GridSettings.test.js
Arik Fraimovich 56d3be2248 Prettier all the Javascript code & GitHub Action (#4433)
* Prettier all the JS files

* Add GitHub Action to autoformat code pushed to master

* Fix eslint violation due to formatting.

* Remove GitHub actions for styling

* Add restyled.io config
2019-12-11 17:05:38 +02:00

44 lines
973 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")
.last()
.simulate("click");
findByTestID(el, "Table.ItemsPerPage.100")
.last()
.simulate("click");
});
});