Skip to content

Commit b4c069e

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

File tree

1 file changed

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

1 file changed

+21
-2
lines changed

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

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,27 @@ 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={{dismissButtonAriaLabel: "Custom Close"}}
140+
>
141+
<div>Content</div>
142+
</Card>,
143+
);
144+
145+
// Act
146+
const dismissButton = screen.getByRole("button", {
147+
name: "Custom Close",
148+
});
149+
150+
// Assert
151+
expect(dismissButton).toBeInTheDocument();
152+
});
153+
154+
it("should pass custom aria-describedby to dismiss button", () => {
135155
// Arrange
136156
render(
137157
<Card
@@ -152,7 +172,6 @@ describe("Card", () => {
152172
});
153173

154174
// Assert
155-
expect(dismissButton).toBeInTheDocument();
156175
expect(dismissButton).toHaveAttribute(
157176
"aria-describedby",
158177
"dismiss-button-describedby",

0 commit comments

Comments
 (0)