Skip to content

Commit af94963

Browse files
committed
fix: update tests & snapshots for aria-disabled
1 parent 2594b0b commit af94963

File tree

4 files changed

+7
-7
lines changed

4 files changed

+7
-7
lines changed

packages/pluggableWidgets/switch-web/src/__tests__/Switch.spec.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ describe("Switch", () => {
9999
const { container } = renderSwitch(props);
100100
const wrapper = container.querySelector(".widget-switch-btn-wrapper");
101101
expect(wrapper?.classList.contains("disabled")).toBe(false);
102-
expect(wrapper?.getAttribute("aria-readonly")).toBe("false");
102+
expect(wrapper?.getAttribute("aria-disabled")).toBe("false");
103103
});
104104

105105
it("invokes action on click", () => {
@@ -173,7 +173,7 @@ describe("Switch", () => {
173173
const { container } = renderSwitch(props);
174174
const wrapper = container.querySelector(".widget-switch-btn-wrapper");
175175
expect(wrapper?.classList.contains("disabled")).toBe(true);
176-
expect(wrapper?.getAttribute("aria-readonly")).toBe("true");
176+
expect(wrapper?.getAttribute("aria-disabled")).toBe("true");
177177
});
178178

179179
it("shouldn't invoke action", () => {

packages/pluggableWidgets/switch-web/src/__tests__/__snapshots__/Switch.spec.tsx.snap

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ exports[`Switch with editable value renders the structure correctly 1`] = `
1616
/>
1717
<div
1818
aria-checked="false"
19+
aria-disabled="false"
1920
aria-labelledby="com.mendix.widgets.custom.switch1-label"
20-
aria-readonly="false"
2121
class="widget-switch-btn-wrapper widget-switch-btn-wrapper-default un-checked"
2222
role="switch"
2323
tabindex="0"
@@ -47,8 +47,8 @@ exports[`Switch with readonly value renders the structure correctly 1`] = `
4747
/>
4848
<div
4949
aria-checked="false"
50+
aria-disabled="true"
5051
aria-labelledby="com.mendix.widgets.custom.switch1-label"
51-
aria-readonly="true"
5252
class="widget-switch-btn-wrapper widget-switch-btn-wrapper-default disabled un-checked"
5353
role="switch"
5454
tabindex="0"

packages/pluggableWidgets/switch-web/src/components/Switch.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ export default function Switch(props: SwitchProps): ReactElement {
3838
role="switch"
3939
aria-checked={props.isChecked}
4040
aria-labelledby={`${props.id}-label`}
41-
aria-readonly={!props.editable}
41+
aria-disabled={!props.editable}
4242
>
4343
<div
4444
className={classNames("widget-switch-btn", {

packages/pluggableWidgets/switch-web/src/components/__tests__/Switch.spec.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ describe("Switch", () => {
2121
renderSwitch();
2222
expect(screen.getByRole("switch")).toBeInTheDocument();
2323
expect(screen.getByRole("switch")).toHaveAttribute("aria-checked", "false");
24-
expect(screen.getByRole("switch")).toHaveAttribute("aria-readonly", "false");
24+
expect(screen.getByRole("switch")).toHaveAttribute("aria-disabled", "false");
2525
});
2626

2727
it("shows checked state", () => {
@@ -32,7 +32,7 @@ describe("Switch", () => {
3232
it("shows disabled state", () => {
3333
renderSwitch({ editable: false });
3434
expect(screen.getByRole("switch")).toHaveClass("disabled");
35-
expect(screen.getByRole("switch")).toHaveAttribute("aria-readonly", "true");
35+
expect(screen.getByRole("switch")).toHaveAttribute("aria-disabled", "true");
3636
});
3737

3838
it("calls onClick when clicked", async () => {

0 commit comments

Comments
 (0)