Skip to content

Commit 0cb8622

Browse files
committed
[WB-2173_dismiss-described-by] separate test case for aria-describedby
1 parent c756ebe commit 0cb8622

File tree

1 file changed

+23
-2
lines changed
  • packages/wonder-blocks-card/src/__tests__/components

1 file changed

+23
-2
lines changed

packages/wonder-blocks-card/src/__tests__/components/card.test.tsx

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,29 @@ describe("Card", () => {
131131
});
132132

133133
describe("Accessibility", () => {
134-
it("should pass custom aria attributes to dismiss button", () => {
134+
it("should pass custom aria-label to dismiss button", () => {
135+
// Arrange
136+
render(
137+
<Card
138+
onDismiss={() => {}}
139+
labels={{
140+
dismissButtonAriaLabel: "Custom Close",
141+
}}
142+
>
143+
<div>Content</div>
144+
</Card>,
145+
);
146+
147+
// Act
148+
const dismissButton = screen.getByRole("button", {
149+
name: "Custom Close",
150+
});
151+
152+
// Assert
153+
expect(dismissButton).toBeInTheDocument();
154+
});
155+
156+
it("should pass custom aria-describedby to dismiss button", () => {
135157
// Arrange
136158
render(
137159
<Card
@@ -152,7 +174,6 @@ describe("Card", () => {
152174
});
153175

154176
// Assert
155-
expect(dismissButton).toBeInTheDocument();
156177
expect(dismissButton).toHaveAttribute(
157178
"aria-describedby",
158179
"dismiss-button-describedby",

0 commit comments

Comments
 (0)