@@ -650,18 +650,39 @@ describe('mdCheckbox', function() {
650
650
it ( 'should change from the indeterminate to checked state correctly' , function ( ) {
651
651
var checked = false ;
652
652
pageScope . isChecked = function ( ) { return checked ; } ;
653
- pageScope . isIndet = function ( ) { return ! checked ; } ;
653
+ pageScope . isIndeterminate = function ( ) { return ! checked ; } ;
654
654
655
- var checkbox = compileAndLink ( '<md-checkbox md-indeterminate="isIndet ()" ng-checked="isChecked()"></md-checkbox>' ) ;
655
+ var checkbox = compileAndLink ( '<md-checkbox md-indeterminate="isIndeterminate ()" ng-checked="isChecked()"></md-checkbox>' ) ;
656
656
657
657
expect ( checkbox ) . toHaveClass ( INDETERMINATE_CSS ) ;
658
658
expect ( checkbox ) . not . toHaveClass ( CHECKED_CSS ) ;
659
+ expect ( checkbox . attr ( 'aria-checked' ) ) . toEqual ( 'mixed' ) ;
659
660
660
661
checked = true ;
661
662
pageScope . $apply ( ) ;
662
663
663
664
expect ( checkbox ) . not . toHaveClass ( INDETERMINATE_CSS ) ;
664
665
expect ( checkbox ) . toHaveClass ( CHECKED_CSS ) ;
666
+ expect ( checkbox . attr ( 'aria-checked' ) ) . toEqual ( 'true' ) ;
667
+ } ) ;
668
+
669
+ it ( 'should change from the indeterminate to unchecked state correctly' , function ( ) {
670
+ var checked = true ;
671
+ pageScope . isChecked = function ( ) { return checked ; } ;
672
+ pageScope . isIndeterminate = function ( ) { return checked ; } ;
673
+
674
+ var checkbox = compileAndLink ( '<md-checkbox md-indeterminate="isIndeterminate()" ng-checked="isChecked()"></md-checkbox>' ) ;
675
+
676
+ expect ( checkbox ) . toHaveClass ( INDETERMINATE_CSS ) ;
677
+ expect ( checkbox ) . not . toHaveClass ( CHECKED_CSS ) ;
678
+ expect ( checkbox . attr ( 'aria-checked' ) ) . toEqual ( 'mixed' ) ;
679
+
680
+ checked = false ;
681
+ pageScope . $apply ( ) ;
682
+
683
+ expect ( checkbox ) . not . toHaveClass ( INDETERMINATE_CSS ) ;
684
+ expect ( checkbox ) . not . toHaveClass ( CHECKED_CSS ) ;
685
+ expect ( checkbox . attr ( 'aria-checked' ) ) . toEqual ( 'false' ) ;
665
686
} ) ;
666
687
667
688
it ( 'should mark the checkbox as selected, if the model is true and "md-indeterminate" is false' , function ( ) {
@@ -670,6 +691,7 @@ describe('mdCheckbox', function() {
670
691
671
692
expect ( checkbox ) . toHaveClass ( CHECKED_CSS ) ;
672
693
expect ( checkbox ) . not . toHaveClass ( INDETERMINATE_CSS ) ;
694
+ expect ( checkbox . attr ( 'aria-checked' ) ) . toEqual ( 'true' ) ;
673
695
} ) ;
674
696
675
697
} ) ;
0 commit comments