DynamicTable: Extend publication-state tests

This commit is contained in:
Gustav Hansen 2023-03-16 10:54:17 +01:00
parent 27753fc03b
commit 87b3fdfb33

View File

@ -17,14 +17,28 @@ const setup = (props) => render(<ComponentFixture {...props} />);
describe('DynamicTable | PublicationState', () => {
test('render draft state', () => {
const { getByText } = setup({ isPublished: false });
const { container, getByText } = setup({ isPublished: false });
expect(getByText('Draft')).toBeInTheDocument();
const statusNode = container.children[0];
const statusNodeStyle = window.getComputedStyle(statusNode);
const textNode = getByText('Draft');
expect(textNode).toBeInTheDocument();
expect(statusNodeStyle).toHaveProperty('background-color', 'rgb(234, 245, 255)');
expect(window.getComputedStyle(textNode)).toHaveProperty('color', 'rgb(12, 117, 175)');
});
test('render published state', () => {
const { getByText } = setup({ isPublished: true });
const { container, getByText } = setup({ isPublished: true });
expect(getByText('Published')).toBeInTheDocument();
const statusNode = container.children[0];
const statusNodeStyle = window.getComputedStyle(statusNode);
const textNode = getByText('Published');
expect(textNode).toBeInTheDocument();
expect(statusNodeStyle).toHaveProperty('background-color', 'rgb(234, 251, 231)');
expect(window.getComputedStyle(textNode)).toHaveProperty('color', 'rgb(50, 128, 72)');
});
});