@@ -4617,6 +4617,67 @@ QUnit.module('Aria accessibility', {
4617
4617
fx . off = false ;
4618
4618
}
4619
4619
} , ( ) => {
4620
+ QUnit . test ( 'aria-label should be "Read-only calendar" and role = group when readOnly option is true' , function ( assert ) {
4621
+ const $element = this . $element ;
4622
+
4623
+ $element . dxCalendar ( {
4624
+ readOnly : true
4625
+ } ) . dxCalendar ( 'instance' ) ;
4626
+
4627
+ assert . strictEqual ( $element . attr ( 'aria-label' ) , 'Read-only calendar' , 'aria-label is set correctly' ) ;
4628
+ assert . strictEqual ( $element . attr ( 'role' ) , 'group' , 'role is set correctly' ) ;
4629
+ } ) ;
4630
+
4631
+ QUnit . test ( 'aria-label and role should be removed when readOnly option is false' , function ( assert ) {
4632
+ const $element = this . $element ;
4633
+
4634
+ $element . dxCalendar ( {
4635
+ readOnly : false
4636
+ } ) . dxCalendar ( 'instance' ) ;
4637
+
4638
+ assert . notOk ( $element . attr ( 'aria-label' ) , 'aria-label is not set' ) ;
4639
+ assert . notOk ( $element . attr ( 'role' ) , 'role is not set' ) ;
4640
+ } ) ;
4641
+
4642
+ QUnit . test ( 'aria-label and role should be removed when readOnly option is set to false on runtime' , function ( assert ) {
4643
+ const $element = this . $element ;
4644
+
4645
+ const calendar = $element . dxCalendar ( {
4646
+ readOnly : true
4647
+ } ) . dxCalendar ( 'instance' ) ;
4648
+
4649
+ calendar . option ( 'readOnly' , false ) ;
4650
+
4651
+ assert . notOk ( $element . attr ( 'aria-label' ) , 'aria-label is removed' ) ;
4652
+ assert . notOk ( $element . attr ( 'role' ) , 'role is removed' ) ;
4653
+ } ) ;
4654
+
4655
+ QUnit . test ( 'aria-label and role should be setted when readOnly option is set to true on runtime' , function ( assert ) {
4656
+ const $element = this . $element ;
4657
+
4658
+ const calendar = $element . dxCalendar ( {
4659
+ readOnly : false
4660
+ } ) . dxCalendar ( 'instance' ) ;
4661
+
4662
+ calendar . option ( 'readOnly' , true ) ;
4663
+
4664
+ assert . strictEqual ( $element . attr ( 'aria-label' ) , 'Read-only calendar' , 'aria-label is set correctly' ) ;
4665
+ assert . strictEqual ( $element . attr ( 'role' ) , 'group' , 'role is set correctly' ) ;
4666
+ } ) ;
4667
+
4668
+ QUnit . test ( 'aria-label attribute should be equal to custom localized text' , function ( assert ) {
4669
+ const localizedText = 'For Testing' ;
4670
+ localization . loadMessages ( { 'en' : { 'dxCalendar-readOnlyLabel' : localizedText } } ) ;
4671
+
4672
+ const $element = this . $element ;
4673
+
4674
+ $element . dxCalendar ( {
4675
+ readOnly : true
4676
+ } ) ;
4677
+
4678
+ assert . strictEqual ( $element . attr ( 'aria-label' ) , localizedText , 'aria-label is set correctly' ) ;
4679
+ } ) ;
4680
+
4620
4681
QUnit . test ( 'aria-activedescendant on views wrapper should point to the focused cell' , function ( assert ) {
4621
4682
const $element = this . $element ;
4622
4683
0 commit comments