@@ -387,4 +387,90 @@ describe("Accessibility", () => {
387387 . should ( "have.attr" , "aria-label" , labelText ) ;
388388 } ) ;
389389 } ) ;
390- } ) ;
390+
391+ it ( "should provide correct accessibilityInfo properties" , ( ) => {
392+ cy . mount (
393+ < >
394+ < CheckBox
395+ id = "accessibilityTestCb"
396+ text = "Accessibility Test"
397+ required
398+ readonly
399+ accessibleName = "Custom Aria Label"
400+ > </ CheckBox >
401+ </ >
402+ ) ;
403+
404+ cy . get ( "#accessibilityTestCb" ) . then ( $checkbox => {
405+ const checkbox = $checkbox [ 0 ] as CheckBox ;
406+ const accInfo = checkbox . accessibilityInfo ;
407+
408+ // Description should come from accessibleName property
409+ expect ( accInfo . description ) . to . equal ( "Custom Aria Label" ) ;
410+
411+ expect ( accInfo . readonly ) . to . be . true ;
412+ expect ( accInfo . required ) . to . be . true ;
413+ expect ( accInfo . disabled ) . to . be . false ;
414+
415+ expect ( accInfo . role ) . to . equal ( "checkbox" ) ;
416+ } ) ;
417+ } ) ;
418+
419+ it ( "should provide correct accessibilityInfo description from accessibleNameRef" , ( ) => {
420+ cy . mount (
421+ < >
422+ < label id = "cb-label" > Label For Accessibility Test</ label >
423+ < CheckBox
424+ id = "accessibilityTestCb1"
425+ accessibleNameRef = "cb-label"
426+ > </ CheckBox >
427+ </ >
428+ ) ;
429+
430+ cy . get ( "#accessibilityTestCb1" ) . then ( $checkbox => {
431+ const checkbox = $checkbox [ 0 ] as CheckBox ;
432+ const accInfo = checkbox . accessibilityInfo ;
433+
434+ // Description should come from associated label
435+ expect ( accInfo . description ) . to . equal ( "Label For Accessibility Test" ) ;
436+ } ) ;
437+ } ) ;
438+
439+ it ( "should provide correct accessibilityInfo description from text" , ( ) => {
440+ cy . mount (
441+ < >
442+ < CheckBox
443+ id = "accessibilityTestCb2"
444+ text = "Accessibility Test Text"
445+ > </ CheckBox >
446+ </ >
447+ ) ;
448+
449+ cy . get ( "#accessibilityTestCb2" ) . then ( $checkbox => {
450+ const checkbox = $checkbox [ 0 ] as CheckBox ;
451+ const accInfo = checkbox . accessibilityInfo ;
452+
453+ // Description should come from text property
454+ expect ( accInfo . description ) . to . equal ( "Accessibility Test Text" ) ;
455+ } ) ;
456+ } ) ;
457+
458+ it ( "should provide correct accessibilityInfo description from associated label" , ( ) => {
459+ cy . mount (
460+ < >
461+ < label for = "accessibilityTestCb3" > Label For Accessibility Test</ label >
462+ < CheckBox
463+ id = "accessibilityTestCb3"
464+ > </ CheckBox >
465+ </ >
466+ ) ;
467+
468+ cy . get ( "#accessibilityTestCb3" ) . then ( $checkbox => {
469+ const checkbox = $checkbox [ 0 ] as CheckBox ;
470+ const accInfo = checkbox . accessibilityInfo ;
471+
472+ // Description should come from associated label
473+ expect ( accInfo . description ) . to . equal ( "Label For Accessibility Test" ) ;
474+ } ) ;
475+ } ) ;
476+ } ) ;
0 commit comments