@@ -29,6 +29,15 @@ describe('progressbar directive', function () {
2929 expect ( getBar ( 0 ) . css ( 'width' ) ) . toBe ( '22%' ) ;
3030 } ) ;
3131
32+ it ( 'has the appropriate aria markup' , function ( ) {
33+ var bar = getBar ( 0 ) ;
34+ expect ( bar . attr ( 'role' ) ) . toBe ( 'progressbar' ) ;
35+ expect ( bar . attr ( 'aria-valuemin' ) ) . toBe ( '0' ) ;
36+ expect ( bar . attr ( 'aria-valuemax' ) ) . toBe ( '100' ) ;
37+ expect ( bar . attr ( 'aria-valuenow' ) ) . toBe ( '22' ) ;
38+ expect ( bar . attr ( 'aria-valuetext' ) ) . toBe ( '22%' ) ;
39+ } ) ;
40+
3241 it ( 'transcludes "bar" text' , function ( ) {
3342 expect ( getBar ( 0 ) . text ( ) ) . toBe ( '22 %' ) ;
3443 } ) ;
@@ -43,13 +52,30 @@ describe('progressbar directive', function () {
4352 expect ( getBar ( 0 ) ) . toHaveClass ( 'pizza' ) ;
4453 } ) ;
4554
55+ it ( 'adjusts the "bar" width and aria when value changes' , function ( ) {
56+ $rootScope . value = 60 ;
57+ $rootScope . $digest ( ) ;
58+
59+ var bar = getBar ( 0 ) ;
60+ expect ( bar . css ( 'width' ) ) . toBe ( '60%' ) ;
61+
62+ expect ( bar . attr ( 'aria-valuemin' ) ) . toBe ( '0' ) ;
63+ expect ( bar . attr ( 'aria-valuemax' ) ) . toBe ( '100' ) ;
64+ expect ( bar . attr ( 'aria-valuenow' ) ) . toBe ( '60' ) ;
65+ expect ( bar . attr ( 'aria-valuetext' ) ) . toBe ( '60%' ) ;
66+ } ) ;
67+
4668 describe ( '"max" attribute' , function ( ) {
4769 beforeEach ( inject ( function ( ) {
4870 $rootScope . max = 200 ;
4971 element = $compile ( '<progressbar max="max" animate="false" value="value">{{value}}/{{max}}</progressbar>' ) ( $rootScope ) ;
5072 $rootScope . $digest ( ) ;
5173 } ) ) ;
5274
75+ it ( 'has the appropriate aria markup' , function ( ) {
76+ expect ( getBar ( 0 ) . attr ( 'aria-valuemax' ) ) . toBe ( '200' ) ;
77+ } ) ;
78+
5379 it ( 'adjusts the "bar" width' , function ( ) {
5480 expect ( element . children ( ) . eq ( 0 ) . css ( 'width' ) ) . toBe ( '11%' ) ;
5581 } ) ;
0 commit comments