mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-17 03:01:25 +00:00
test: add unit tests for AspectRatio
, Tag
This commit is contained in:
parent
cee676331a
commit
f3a8d9972c
7 changed files with 158 additions and 13 deletions
15
tests/AspectRatio/AspectRatio.test.ts
Normal file
15
tests/AspectRatio/AspectRatio.test.ts
Normal file
|
@ -0,0 +1,15 @@
|
|||
import { render, screen } from "@testing-library/svelte";
|
||||
import AspectRatio from "./AspectRatio.test.svelte";
|
||||
|
||||
describe("AspectRatio", () => {
|
||||
it("renders correctly", () => {
|
||||
render(AspectRatio);
|
||||
|
||||
["2x1", "2x3", "16x9", "4x3", "1x1", "3x4", "3x2", "9x16", "1x2"].forEach(
|
||||
(ratio) => {
|
||||
const boundingElement = screen.getByText(ratio).parentElement;
|
||||
expect(boundingElement).toHaveClass(`bx--aspect-ratio--${ratio}`);
|
||||
},
|
||||
);
|
||||
});
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue