import { render } from '../test-utils';
import Emphasis from './Emphasis';
describe('Emphasis', () => {
describe('renders emphasis text in span and in em emphased bit', () => {
it.each`
text | selector
${'important'} | ${'em.emphasis.emphasis--important'}
${'positive'} | ${'em.emphasis.emphasis--positive'}
${'negative'} | ${'em.emphasis.emphasis--negative'}
${'warning'} | ${'em.emphasis.emphasis--warning'}
`(
'$text renders as expected with selectoe $selector',
({ text, selector }: Record) => {
const { container } = render();
expect(container.querySelector(selector)).toBeInTheDocument();
expect(container?.firstElementChild?.tagName).toBe('SPAN');
},
);
});
it('escapes malicious tags', () => {
const { container } = render();
expect(container.querySelector('script')).not.toBeInTheDocument();
});
});