@@ -116,7 +116,7 @@ describe('progressbar directive', function () {
116
116
it ( 'transcludes "bar" text' , function ( ) {
117
117
expect ( getBar ( 0 ) . text ( ) ) . toBe ( '22/200' ) ;
118
118
} ) ;
119
-
119
+
120
120
it ( 'adjusts the valuemax when it changes' , function ( ) {
121
121
expect ( getBar ( 0 ) . attr ( 'aria-valuemax' ) ) . toBe ( '200' ) ;
122
122
$rootScope . max = 300 ;
@@ -215,5 +215,49 @@ describe('progressbar directive', function () {
215
215
expect ( getBar ( 0 ) ) . not . toHaveClass ( BAR_CLASS + '-success' ) ;
216
216
expect ( getBar ( 0 ) ) . not . toHaveClass ( BAR_CLASS + '-warning' ) ;
217
217
} ) ;
218
+
219
+ describe ( '"max" attribute' , function ( ) {
220
+ beforeEach ( inject ( function ( ) {
221
+ $rootScope . max = 200 ;
222
+ element = $compile ( '<progress max="max" animate="false"><bar ng-repeat="o in objects" value="o.value">{{o.value}}/{{max}}</bar></progress>' ) ( $rootScope ) ;
223
+ $rootScope . $digest ( ) ;
224
+ } ) ) ;
225
+
226
+ it ( 'has the appropriate aria markup' , function ( ) {
227
+ expect ( getBar ( 0 ) . attr ( 'aria-valuemax' ) ) . toBe ( '200' ) ;
228
+ } ) ;
229
+
230
+ it ( 'adjusts the "bar" width when it changes' , function ( ) {
231
+ expect ( getBar ( 0 ) . css ( 'width' ) ) . toBe ( '5%' ) ;
232
+ $rootScope . max = 250 ;
233
+ $rootScope . $digest ( ) ;
234
+ expect ( getBar ( 0 ) . css ( 'width' ) ) . toBe ( '4%' ) ;
235
+ } ) ;
236
+
237
+ it ( 'adjusts the "bar" width when value changes' , function ( ) {
238
+ $rootScope . objects [ 0 ] . value = 60 ;
239
+ $rootScope . $digest ( ) ;
240
+ expect ( getBar ( 0 ) . css ( 'width' ) ) . toBe ( '30%' ) ;
241
+
242
+ $rootScope . objects [ 0 ] . value += 12 ;
243
+ $rootScope . $digest ( ) ;
244
+ expect ( getBar ( 0 ) . css ( 'width' ) ) . toBe ( '36%' ) ;
245
+
246
+ $rootScope . objects [ 0 ] . value = 0 ;
247
+ $rootScope . $digest ( ) ;
248
+ expect ( getBar ( 0 ) . css ( 'width' ) ) . toBe ( '0%' ) ;
249
+ } ) ;
250
+
251
+ it ( 'transcludes "bar" text' , function ( ) {
252
+ expect ( getBar ( 0 ) . text ( ) ) . toBe ( '10/200' ) ;
253
+ } ) ;
254
+
255
+ it ( 'adjusts the valuemax when it changes' , function ( ) {
256
+ expect ( getBar ( 0 ) . attr ( 'aria-valuemax' ) ) . toBe ( '200' ) ;
257
+ $rootScope . max = 300 ;
258
+ $rootScope . $digest ( ) ;
259
+ expect ( getBar ( 0 ) . attr ( 'aria-valuemax' ) ) . toBe ( '300' ) ;
260
+ } ) ;
261
+ } ) ;
218
262
} ) ;
219
263
} ) ;
0 commit comments