import { render } from '@stencil/vitest';
describe('ontario-callout', () => {
describe('snapshot', () => {
it('should render the expected html', async () => {
const page = await render(
`Sign up for email reminders and we’ll notify you 60 and 30 days before your licence expires.
`,
);
expect(page.root).toMatchSnapshot();
});
});
it('should render the h2 heading level if no headingType prop is passed', async () => {
const page = await render(
`Sign up for email reminders and we’ll notify you 60 and 30 days before your licence expires.
`,
);
expect(page.root).toEqualHtml(`
Get notified
Sign up for email reminders
and we’ll notify you 60 and 30 days before your licence expires.
`);
});
it('should render the expected heading level when a headingType prop is passed', async () => {
const page = await render(
`Sign up for email reminders and we’ll notify you 60 and 30 days before your licence expires.
`,
);
expect(page.root).toEqualHtml(`
Get notified
Sign up for email reminders
and we’ll notify you 60 and 30 days before your licence expires.
`);
});
it('should render a string heading if no headingContentType prop is passed', async () => {
const page = await render(
`Sign up for email reminders and we’ll notify you 60 and 30 days before your licence expires.
`,
);
expect(page.root).toEqualHtml(`
Get notified
Sign up for email reminders
and we’ll notify you 60 and 30 days before your licence expires.
`);
});
it('should render html in the heading content if the headingContentType prop is set to `html`', async () => {
const page = await render(
`Sign up for email reminders and we’ll notify you 60 and 30 days before your licence expires.
`,
);
expect(page.root).toEqualHtml(`
Sign up for email reminders
and we’ll notify you 60 and 30 days before your licence expires.
`);
});
it('should not render the heading if headingContent prop is set to `undefined`', async () => {
const page = await render(
`Sign up for email reminders and we’ll notify you 60 and 30 days before your licence expires.
`,
);
expect(page.root).toEqualHtml(`
Sign up for email reminders
and we’ll notify you 60 and 30 days before your licence expires.
`);
});
it('should reflect attributes/props being set', async () => {
const page = await render(
``,
);
expect(page.instance.headingType).toBe('h4');
expect(page.instance.headingContentType).toBe('html');
expect(page.instance.headingContent).toBe("Get notified");
expect(page.instance.highlightColour).toBe('purple');
expect(page.instance.content).toBe(
"Sign up for email reminders and we'll notify you 60 and 30 days before your licence expires.",
);
});
});