Skip to content

Commit

Permalink
test(Loading): add tests for rendered elements and title inside svg
Browse files Browse the repository at this point in the history
  • Loading branch information
sarkaaa committed Feb 19, 2025
1 parent 29eb524 commit 90d8c4e
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions packages/orbit-components/src/Loading/__tests__/index.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,19 @@ describe("Loading", () => {
expect(screen.getByTestId("kek").firstChild).toHaveStyle({ width: "40px", height: "40px" });
expect(screen.getByTestId("kek").querySelector("svg")).toBeInTheDocument();
});

it("should render element as a div", () => {
render(<Loading asComponent="span" dataTest="kek" text="Loading..." />);
expect(screen.getByTestId("kek").tagName).toBe("DIV");
});

it("should render element as a span", () => {
render(<Loading asComponent="span" dataTest="kek" />);
expect(screen.getByTestId("kek").tagName).toBe("SPAN");
});

it("should render a title element inside svg", () => {
render(<Loading title="Content is loading..." dataTest="kek" />);
expect(screen.getByTestId("kek").querySelector("title")).toBeInTheDocument();
});
});

0 comments on commit 90d8c4e

Please sign in to comment.