import { create } from 'react-test-renderer';
import TextUI from './TextUI';
test('TextUI renders', () => {
const tree = create().toJSON();
expect(tree).toMatchSnapshot();
});
test('TextUI warning adds the warning color class', () => {
const tree = create().toJSON();
expect(tree).toMatchSnapshot();
});
test('TextUI error adds the error color class', () => {
const tree = create().toJSON();
expect(tree).toMatchSnapshot();
});
test('TextUI size 100 adds the smallest size class', () => {
const tree = create().toJSON();
expect(tree).toMatchSnapshot();
});
test('TextUI lineClamp should add a title when the children are text only', () => {
const tree = create(
Shall I compare thee to a summer's day - William Shakespeare,
).toJSON();
expect(tree).toMatchSnapshot();
});
test('TextUI lineClamp should not add a title when the children are objects', () => {
const tree = create(
Summer reading:
Shall I compare thee to a summer's day - William Shakespeare
,
).toJSON();
expect(tree).toMatchSnapshot();
});
test('validate data test id for text', () => {
const component = create(Testing).root;
expect(
component
.findAll((element) => element.type === 'div')
.filter((node) => node.props['data-test-id'] === 'test-text'),
).toHaveLength(1);
});