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');
|
|
|
|
|
2022-03-17 10:31:09 +00:00
|
|
|
const attributes: Record<string, unknown> = {
|
|
|
|
href: 'https://example.org',
|
|
|
|
};
|
2022-03-16 00:06:35 +00:00
|
|
|
t.snapshot(
|
2022-03-17 10:31:09 +00:00
|
|
|
render(html`<${PrivacyLink} attributes=${attributes}>Example<//>`),
|
2022-03-16 00:06:35 +00:00
|
|
|
'Text children',
|
|
|
|
);
|
|
|
|
|
|
|
|
t.snapshot(
|
|
|
|
render(
|
|
|
|
html`
|
2022-03-17 10:31:09 +00:00
|
|
|
<${PrivacyLink} attributes=${attributes}>
|
2022-03-16 00:06:35 +00:00
|
|
|
Example <span class="bold">with children</span>
|
|
|
|
<//>
|
|
|
|
`,
|
|
|
|
),
|
|
|
|
'HTML children',
|
|
|
|
);
|
|
|
|
|
2022-03-17 10:31:09 +00:00
|
|
|
attributes.class = 'bold italic';
|
2022-03-16 00:06:35 +00:00
|
|
|
t.snapshot(
|
2022-03-17 10:31:09 +00:00
|
|
|
render(html`<${PrivacyLink} attributes=${attributes}>Example<//>`),
|
2022-03-16 00:06:35 +00:00
|
|
|
'CSS class',
|
|
|
|
);
|
|
|
|
});
|