preact-components/tests/links/privacy-link.test.ts

35 lines
793 B
TypeScript
Raw Normal View History

2022-03-16 00:06:35 +00:00
import test from 'ava';
import {html} from 'htm/preact';
import {render} from 'preact-render-to-string';
import {PrivacyLink} from '../../source/gram.js';
test('PrivacyLink', (t) => {
t.snapshot(render(html`<${PrivacyLink} />`), 'Empty');
const attributes: Record<string, unknown> = {
href: 'https://example.org',
};
2022-03-16 00:06:35 +00:00
t.snapshot(
render(html`<${PrivacyLink} attributes=${attributes}>Example<//>`),
2022-03-16 00:06:35 +00:00
'Text children',
);
t.snapshot(
render(
html`
<${PrivacyLink} attributes=${attributes}>
2022-03-16 00:06:35 +00:00
Example <span class="bold">with children</span>
<//>
`,
),
'HTML children',
);
attributes.class = 'bold italic';
2022-03-16 00:06:35 +00:00
t.snapshot(
render(html`<${PrivacyLink} attributes=${attributes}>Example<//>`),
2022-03-16 00:06:35 +00:00
'CSS class',
);
});