import { render } from '@stencil/vitest'; describe('ontario-aside', () => { describe('snapshot', () => { it('should render the expected html', async () => { const page = await render( `As of 2013, Canada is responsible for 1.6% of global emissions, with Ontario responsible for less than 0.4% of global emissions.`, ); expect(page.root).toMatchSnapshot(); }); }); it('should render the h2 heading level if no headingType prop is passed', async () => { const page = await render( `

As of 2013, Canada is responsible for 1.6% of global emissions, with Ontario responsible for less than 0.4% of global emissions.

`, ); expect(page.root).toEqualHtml(`

As of 2013, Canada is responsible for 1.6% of global emissions, with Ontario responsible for less than 0.4% of global emissions.

`); }); it('should render the expected heading level when a headingType prop is passed', async () => { const page = await render( `

As of 2013, Canada is responsible for 1.6% of global emissions, with Ontario responsible for less than 0.4% of global emissions.

`, ); expect(page.root).toEqualHtml(`

As of 2013, Canada is responsible for 1.6% of global emissions, with Ontario responsible for less than 0.4% of global emissions.

`); }); it('should render a string heading if no headingContentType prop is passed', async () => { const page = await render( `

As of 2013, Canada is responsible for 1.6% of global emissions, with Ontario responsible for less than 0.4% of global emissions.

`, ); expect(page.root).toEqualHtml(`

As of 2013, Canada is responsible for 1.6% of global emissions, with Ontario responsible for less than 0.4% of global emissions.

`); }); it('should render html in the heading content if the headingContentType prop is set to `html`', async () => { const page = await render( `

As of 2013, Canada is responsible for 1.6% of global emissions, with Ontario responsible for less than 0.4% of global emissions.

`, ); expect(page.root).toEqualHtml(`

As of 2013, Canada is responsible for 1.6% of global emissions, with Ontario responsible for less than 0.4% of global emissions.

`); }); it('should render html in the heading content if the headingContentType prop is set to `html`', async () => { const page = await render( `

As of 2013, Canada is responsible for 1.6% of global emissions, with Ontario responsible for less than 0.4% of global emissions.

`, ); expect(page.root).toEqualHtml(`

As of 2013, Canada is responsible for 1.6% of global emissions, with Ontario responsible for less than 0.4% of global emissions.

`); }); it('should not render the heading if headingContent prop is set to `undefined`', async () => { const page = await render( `

As of 2013, Canada is responsible for 1.6% of global emissions, with Ontario responsible for less than 0.4% of global emissions.

`, ); expect(page.root).toEqualHtml(`

As of 2013, Canada is responsible for 1.6% of global emissions, with Ontario responsible for less than 0.4% of global emissions.

`); }); 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("Quick fact:"); expect(page.instance.highlightColour).toBe('purple'); expect(page.instance.content).toBe( 'As of 2013, Canada is responsible for 1.6% of global emissions, with Ontario responsible for less than 0.4% of global emissions.', ); }); });