@@ -339,6 +339,28 @@ describe('supports accessibility states', () => {
339
339
getByRole ( 'button' , { name : 'RNButton' , disabled : true } )
340
340
) . toBeTruthy ( ) ;
341
341
} ) ;
342
+
343
+ test ( 'supports aria-disabled={true} prop' , ( ) => {
344
+ const screen = render (
345
+ < View accessible accessibilityRole = "button" aria-disabled = { true } />
346
+ ) ;
347
+ expect ( screen . getByRole ( 'button' , { disabled : true } ) ) . toBeTruthy ( ) ;
348
+ expect ( screen . queryByRole ( 'button' , { disabled : false } ) ) . toBeNull ( ) ;
349
+ } ) ;
350
+
351
+ test ( 'supports aria-disabled={false} prop' , ( ) => {
352
+ const screen = render (
353
+ < View accessible accessibilityRole = "button" aria-disabled = { false } />
354
+ ) ;
355
+ expect ( screen . getByRole ( 'button' , { disabled : false } ) ) . toBeTruthy ( ) ;
356
+ expect ( screen . queryByRole ( 'button' , { disabled : true } ) ) . toBeNull ( ) ;
357
+ } ) ;
358
+
359
+ test ( 'supports default aria-disabled prop' , ( ) => {
360
+ const screen = render ( < View accessible accessibilityRole = "button" /> ) ;
361
+ expect ( screen . getByRole ( 'button' , { disabled : false } ) ) . toBeTruthy ( ) ;
362
+ expect ( screen . queryByRole ( 'button' , { disabled : true } ) ) . toBeNull ( ) ;
363
+ } ) ;
342
364
} ) ;
343
365
344
366
describe ( 'selected' , ( ) => {
@@ -406,6 +428,28 @@ describe('supports accessibility states', () => {
406
428
407
429
expect ( queryByRole ( 'tab' , { selected : false } ) ) . toBe ( null ) ;
408
430
} ) ;
431
+
432
+ test ( 'supports aria-selected={true} prop' , ( ) => {
433
+ const screen = render (
434
+ < View accessible accessibilityRole = "button" aria-selected = { true } />
435
+ ) ;
436
+ expect ( screen . getByRole ( 'button' , { selected : true } ) ) . toBeTruthy ( ) ;
437
+ expect ( screen . queryByRole ( 'button' , { selected : false } ) ) . toBeNull ( ) ;
438
+ } ) ;
439
+
440
+ test ( 'supports aria-selected={false} prop' , ( ) => {
441
+ const screen = render (
442
+ < View accessible accessibilityRole = "button" aria-selected = { false } />
443
+ ) ;
444
+ expect ( screen . getByRole ( 'button' , { selected : false } ) ) . toBeTruthy ( ) ;
445
+ expect ( screen . queryByRole ( 'button' , { selected : true } ) ) . toBeNull ( ) ;
446
+ } ) ;
447
+
448
+ test ( 'supports default aria-selected prop' , ( ) => {
449
+ const screen = render ( < View accessible accessibilityRole = "button" /> ) ;
450
+ expect ( screen . getByRole ( 'button' , { selected : false } ) ) . toBeTruthy ( ) ;
451
+ expect ( screen . queryByRole ( 'button' , { selected : true } ) ) . toBeNull ( ) ;
452
+ } ) ;
409
453
} ) ;
410
454
411
455
describe ( 'checked' , ( ) => {
@@ -508,6 +552,41 @@ describe('supports accessibility states', () => {
508
552
509
553
expect ( queryByRole ( 'checkbox' , { checked : false } ) ) . toBe ( null ) ;
510
554
} ) ;
555
+
556
+ test ( 'supports aria-checked={true} prop' , ( ) => {
557
+ const screen = render (
558
+ < View accessible accessibilityRole = "button" aria-checked = { true } />
559
+ ) ;
560
+ expect ( screen . getByRole ( 'button' , { checked : true } ) ) . toBeTruthy ( ) ;
561
+ expect ( screen . queryByRole ( 'button' , { checked : false } ) ) . toBeNull ( ) ;
562
+ expect ( screen . queryByRole ( 'button' , { checked : 'mixed' } ) ) . toBeNull ( ) ;
563
+ } ) ;
564
+
565
+ test ( 'supports aria-checked={false} prop' , ( ) => {
566
+ const screen = render (
567
+ < View accessible accessibilityRole = "button" aria-checked = { false } />
568
+ ) ;
569
+ expect ( screen . getByRole ( 'button' , { checked : false } ) ) . toBeTruthy ( ) ;
570
+ expect ( screen . queryByRole ( 'button' , { checked : true } ) ) . toBeNull ( ) ;
571
+ expect ( screen . queryByRole ( 'button' , { checked : 'mixed' } ) ) . toBeNull ( ) ;
572
+ } ) ;
573
+
574
+ test ( 'supports aria-checked="mixed prop' , ( ) => {
575
+ const screen = render (
576
+ < View accessible accessibilityRole = "button" aria-checked = "mixed" />
577
+ ) ;
578
+ expect ( screen . getByRole ( 'button' , { checked : 'mixed' } ) ) . toBeTruthy ( ) ;
579
+ expect ( screen . queryByRole ( 'button' , { checked : true } ) ) . toBeNull ( ) ;
580
+ expect ( screen . queryByRole ( 'button' , { checked : false } ) ) . toBeNull ( ) ;
581
+ } ) ;
582
+
583
+ test ( 'supports default aria-selected prop' , ( ) => {
584
+ const screen = render ( < View accessible accessibilityRole = "button" /> ) ;
585
+ expect ( screen . getByRole ( 'button' ) ) . toBeTruthy ( ) ;
586
+ expect ( screen . queryByRole ( 'button' , { checked : true } ) ) . toBeNull ( ) ;
587
+ expect ( screen . queryByRole ( 'button' , { checked : false } ) ) . toBeNull ( ) ;
588
+ expect ( screen . queryByRole ( 'button' , { checked : 'mixed' } ) ) . toBeNull ( ) ;
589
+ } ) ;
511
590
} ) ;
512
591
513
592
describe ( 'busy' , ( ) => {
@@ -575,6 +654,28 @@ describe('supports accessibility states', () => {
575
654
576
655
expect ( queryByRole ( 'button' , { selected : false } ) ) . toBe ( null ) ;
577
656
} ) ;
657
+
658
+ test ( 'supports aria-busy={true} prop' , ( ) => {
659
+ const screen = render (
660
+ < View accessible accessibilityRole = "button" aria-busy = { true } />
661
+ ) ;
662
+ expect ( screen . getByRole ( 'button' , { busy : true } ) ) . toBeTruthy ( ) ;
663
+ expect ( screen . queryByRole ( 'button' , { busy : false } ) ) . toBeNull ( ) ;
664
+ } ) ;
665
+
666
+ test ( 'supports aria-busy={false} prop' , ( ) => {
667
+ const screen = render (
668
+ < View accessible accessibilityRole = "button" aria-busy = { false } />
669
+ ) ;
670
+ expect ( screen . getByRole ( 'button' , { busy : false } ) ) . toBeTruthy ( ) ;
671
+ expect ( screen . queryByRole ( 'button' , { busy : true } ) ) . toBeNull ( ) ;
672
+ } ) ;
673
+
674
+ test ( 'supports default aria-busy prop' , ( ) => {
675
+ const screen = render ( < View accessible accessibilityRole = "button" /> ) ;
676
+ expect ( screen . getByRole ( 'button' , { busy : false } ) ) . toBeTruthy ( ) ;
677
+ expect ( screen . queryByRole ( 'button' , { busy : true } ) ) . toBeNull ( ) ;
678
+ } ) ;
578
679
} ) ;
579
680
580
681
describe ( 'expanded' , ( ) => {
@@ -641,6 +742,29 @@ describe('supports accessibility states', () => {
641
742
642
743
expect ( queryByRole ( 'button' , { expanded : false } ) ) . toBe ( null ) ;
643
744
} ) ;
745
+
746
+ test ( 'supports aria-expanded={true} prop' , ( ) => {
747
+ const screen = render (
748
+ < View accessible accessibilityRole = "button" aria-expanded = { true } />
749
+ ) ;
750
+ expect ( screen . getByRole ( 'button' , { expanded : true } ) ) . toBeTruthy ( ) ;
751
+ expect ( screen . queryByRole ( 'button' , { expanded : false } ) ) . toBeNull ( ) ;
752
+ } ) ;
753
+
754
+ test ( 'supports aria-expanded={false} prop' , ( ) => {
755
+ const screen = render (
756
+ < View accessible accessibilityRole = "button" aria-expanded = { false } />
757
+ ) ;
758
+ expect ( screen . getByRole ( 'button' , { expanded : false } ) ) . toBeTruthy ( ) ;
759
+ expect ( screen . queryByRole ( 'button' , { expanded : true } ) ) . toBeNull ( ) ;
760
+ } ) ;
761
+
762
+ test ( 'supports default aria-expanded prop' , ( ) => {
763
+ const screen = render ( < View accessible accessibilityRole = "button" /> ) ;
764
+ expect ( screen . getByRole ( 'button' ) ) . toBeTruthy ( ) ;
765
+ expect ( screen . queryByRole ( 'button' , { expanded : true } ) ) . toBeNull ( ) ;
766
+ expect ( screen . queryByRole ( 'button' , { expanded : false } ) ) . toBeNull ( ) ;
767
+ } ) ;
644
768
} ) ;
645
769
646
770
test ( 'ignores non queried accessibilityState' , ( ) => {
0 commit comments