File tree Expand file tree Collapse file tree 4 files changed +7
-7
lines changed
packages/pluggableWidgets/switch-web/src Expand file tree Collapse file tree 4 files changed +7
-7
lines changed Original file line number Diff line number Diff line change @@ -99,7 +99,7 @@ describe("Switch", () => {
99
99
const { container } = renderSwitch ( props ) ;
100
100
const wrapper = container . querySelector ( ".widget-switch-btn-wrapper" ) ;
101
101
expect ( wrapper ?. classList . contains ( "disabled" ) ) . toBe ( false ) ;
102
- expect ( wrapper ?. getAttribute ( "aria-readonly " ) ) . toBe ( "false" ) ;
102
+ expect ( wrapper ?. getAttribute ( "aria-disabled " ) ) . toBe ( "false" ) ;
103
103
} ) ;
104
104
105
105
it ( "invokes action on click" , ( ) => {
@@ -173,7 +173,7 @@ describe("Switch", () => {
173
173
const { container } = renderSwitch ( props ) ;
174
174
const wrapper = container . querySelector ( ".widget-switch-btn-wrapper" ) ;
175
175
expect ( wrapper ?. classList . contains ( "disabled" ) ) . toBe ( true ) ;
176
- expect ( wrapper ?. getAttribute ( "aria-readonly " ) ) . toBe ( "true" ) ;
176
+ expect ( wrapper ?. getAttribute ( "aria-disabled " ) ) . toBe ( "true" ) ;
177
177
} ) ;
178
178
179
179
it ( "shouldn't invoke action" , ( ) => {
Original file line number Diff line number Diff line change @@ -16,8 +16,8 @@ exports[`Switch with editable value renders the structure correctly 1`] = `
16
16
/>
17
17
<div
18
18
aria-checked = " false"
19
+ aria-disabled = " false"
19
20
aria-labelledby = " com.mendix.widgets.custom.switch1-label"
20
- aria-readonly = " false"
21
21
class = " widget-switch-btn-wrapper widget-switch-btn-wrapper-default un-checked"
22
22
role = " switch"
23
23
tabindex = " 0"
@@ -47,8 +47,8 @@ exports[`Switch with readonly value renders the structure correctly 1`] = `
47
47
/>
48
48
<div
49
49
aria-checked = " false"
50
+ aria-disabled = " true"
50
51
aria-labelledby = " com.mendix.widgets.custom.switch1-label"
51
- aria-readonly = " true"
52
52
class = " widget-switch-btn-wrapper widget-switch-btn-wrapper-default disabled un-checked"
53
53
role = " switch"
54
54
tabindex = " 0"
Original file line number Diff line number Diff line change @@ -38,7 +38,7 @@ export default function Switch(props: SwitchProps): ReactElement {
38
38
role = "switch"
39
39
aria-checked = { props . isChecked }
40
40
aria-labelledby = { `${ props . id } -label` }
41
- aria-readonly = { ! props . editable }
41
+ aria-disabled = { ! props . editable }
42
42
>
43
43
< div
44
44
className = { classNames ( "widget-switch-btn" , {
Original file line number Diff line number Diff line change @@ -21,7 +21,7 @@ describe("Switch", () => {
21
21
renderSwitch ( ) ;
22
22
expect ( screen . getByRole ( "switch" ) ) . toBeInTheDocument ( ) ;
23
23
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" ) ;
25
25
} ) ;
26
26
27
27
it ( "shows checked state" , ( ) => {
@@ -32,7 +32,7 @@ describe("Switch", () => {
32
32
it ( "shows disabled state" , ( ) => {
33
33
renderSwitch ( { editable : false } ) ;
34
34
expect ( screen . getByRole ( "switch" ) ) . toHaveClass ( "disabled" ) ;
35
- expect ( screen . getByRole ( "switch" ) ) . toHaveAttribute ( "aria-readonly " , "true" ) ;
35
+ expect ( screen . getByRole ( "switch" ) ) . toHaveAttribute ( "aria-disabled " , "true" ) ;
36
36
} ) ;
37
37
38
38
it ( "calls onClick when clicked" , async ( ) => {
You can’t perform that action at this time.
0 commit comments