@@ -105,11 +105,6 @@ describe('md-datepicker', function() {
105105 expect ( controller . inputElement . placeholder ) . toBe ( 'Fancy new placeholder' ) ;
106106 } ) ;
107107
108- it ( 'should forward the aria-label to the generated input' , function ( ) {
109- createDatepickerInstance ( '<md-datepicker ng-model="myDate" aria-label="Enter a date"></md-datepicker>' ) ;
110- expect ( controller . ngInputElement . attr ( 'aria-label' ) ) . toBe ( 'Enter a date' ) ;
111- } ) ;
112-
113108 it ( 'should throw an error when the model is not a date' , function ( ) {
114109 expect ( function ( ) {
115110 pageScope . myDate = '2015-01-01' ;
@@ -793,20 +788,53 @@ describe('md-datepicker', function() {
793788 } ) ;
794789 } ) ;
795790
796- describe ( 'tabindex behavior ' , function ( ) {
797- beforeEach ( function ( ) {
791+ describe ( 'accessibility ' , function ( ) {
792+ it ( 'should forward the aria-label to the generated input' , function ( ) {
798793 ngElement && ngElement . remove ( ) ;
794+ createDatepickerInstance ( '<md-datepicker ng-model="myDate" aria-label="Enter a date"></md-datepicker>' ) ;
795+ expect ( controller . ngInputElement . attr ( 'aria-label' ) ) . toBe ( 'Enter a date' ) ;
799796 } ) ;
800797
801- it ( 'should remove the datepicker from the tab order, if no tabindex is specified' , function ( ) {
802- createDatepickerInstance ( '<md-datepicker ng-model="myDate"></md-datepicker>' ) ;
803- expect ( ngElement . attr ( 'tabindex' ) ) . toBe ( '-1' ) ;
798+ it ( 'should set the aria-owns value, corresponding to the id of the calendar pane' , function ( ) {
799+ var ariaAttr = controller . ngInputElement . attr ( 'aria-owns' ) ;
800+
801+ expect ( ariaAttr ) . toBeTruthy ( ) ;
802+ expect ( controller . calendarPane . id ) . toBe ( ariaAttr ) ;
804803 } ) ;
805804
806- it ( 'should forward the tabindex to the input' , function ( ) {
807- createDatepickerInstance ( '<md-datepicker ng-model="myDate" tabindex="1"></md-datepicker>' ) ;
808- expect ( ngElement . attr ( 'tabindex' ) ) . toBeFalsy ( ) ;
809- expect ( controller . ngInputElement . attr ( 'tabindex' ) ) . toBe ( '1' ) ;
805+ it ( 'should toggle the aria-expanded value' , function ( ) {
806+ expect ( controller . ngInputElement . attr ( 'aria-expanded' ) ) . toBe ( 'false' ) ;
807+
808+ controller . openCalendarPane ( {
809+ target : controller . inputElement
810+ } ) ;
811+ scope . $apply ( ) ;
812+
813+ expect ( controller . ngInputElement . attr ( 'aria-expanded' ) ) . toBe ( 'true' ) ;
814+
815+ controller . closeCalendarPane ( ) ;
816+ scope . $apply ( ) ;
817+
818+ expect ( controller . ngInputElement . attr ( 'aria-expanded' ) ) . toBe ( 'false' ) ;
819+ } ) ;
820+
821+ describe ( 'tabindex behavior' , function ( ) {
822+ beforeEach ( function ( ) {
823+ ngElement && ngElement . remove ( ) ;
824+ } ) ;
825+
826+ it ( 'should remove the datepicker from the tab order, if no tabindex is specified' , function ( ) {
827+ createDatepickerInstance ( '<md-datepicker ng-model="myDate"></md-datepicker>' ) ;
828+ expect ( ngElement . attr ( 'tabindex' ) ) . toBe ( '-1' ) ;
829+ } ) ;
830+
831+ it ( 'should forward the tabindex to the input' , function ( ) {
832+ createDatepickerInstance ( '<md-datepicker ng-model="myDate" tabindex="1"></md-datepicker>' ) ;
833+ expect ( ngElement . attr ( 'tabindex' ) ) . toBeFalsy ( ) ;
834+ expect ( controller . ngInputElement . attr ( 'tabindex' ) ) . toBe ( '1' ) ;
835+ } ) ;
810836 } ) ;
837+
811838 } ) ;
839+
812840} ) ;
0 commit comments