Files
redash/client/app/visualizations/table/columns/text.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

58 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")
.last()
.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")
.last()
.find("input")
.simulate("change", { target: { checked: true } });
});
});
});