Skip to content

Commit

Permalink
test(web-components): add banner test with undefined props
Browse files Browse the repository at this point in the history
  • Loading branch information
evenstensberg committed Aug 2, 2024
1 parent 7613d26 commit 60a9740
Showing 1 changed file with 33 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,39 @@ describe("ic-classification-banner component", () => {
</ic-classification-banner>`);
});

it("should render default banner if no props are passed", async () => {
const page = await newSpecPage({
components: [ClassificationBanner],
html: `<ic-classification-banner></ic-classification-banner>`,
});
expect(page.root).toEqualHtml(`
<ic-classification-banner>
<mock:shadow-root>
<banner aria-label="Protective marking" class="classification-banner default">
<ic-typography variant="caption-uppercase">
protective marking not set
</ic-typography>
</banner>
</mock:shadow-root>
</ic-classification-banner>`);
});

it("should render default banner if props with empty strings are passed", async () => {
const page = await newSpecPage({
components: [ClassificationBanner],
html: `<ic-classification-banner classification="" country="" additionalSelectors=""></ic-classification-banner>`,
});
expect(page.root).toEqualHtml(`
<ic-classification-banner classification="" country="" additionalSelectors="">
<mock:shadow-root>
<banner aria-label="Protective marking" class="classification-banner default">
<ic-typography variant="caption-uppercase">
protective marking not set
</ic-typography>
</banner>
</mock:shadow-root>
</ic-classification-banner>`);
});
it("should render with additional selectors after classification when supplied", async () => {
const page = await newSpecPage({
components: [ClassificationBanner],
Expand Down

0 comments on commit 60a9740

Please sign in to comment.