]> source.dussan.org Git - jquery-ui.git/commitdiff
Progressbar: Only remove aria-valuenow for indeterminate progressbars. Added more...
authorScott González <scott.gonzalez@gmail.com>
Thu, 6 Dec 2012 14:35:41 +0000 (09:35 -0500)
committerScott González <scott.gonzalez@gmail.com>
Thu, 6 Dec 2012 14:35:41 +0000 (09:35 -0500)
tests/unit/progressbar/progressbar_common.js
tests/unit/progressbar/progressbar_core.js
ui/jquery.ui.progressbar.js

index ceee3fbec0769a68f1fd43dfbbb001b1549e23c1..0768576f568b551fd6870b8ad7500b962a2954a7 100644 (file)
@@ -1,8 +1,8 @@
 TestHelpers.commonWidgetTests( "progressbar", {
        defaults: {
                disabled: false,
-               value: 0,
                max: 100,
+               value: 0,
 
                //callbacks
                change: null,
index 0a2ef895bd254190efefac7d79339b80025004e1..54a33cc9d7da0d3613d223ee88a137b0c43eec89 100644 (file)
@@ -1,7 +1,7 @@
 module( "progressbar: core" );
 
 test( "accessibility", function() {
-       expect( 7 );
+       expect( 11 );
        var element = $( "#progressbar" ).progressbar();
 
        equal( element.attr( "role" ), "progressbar", "aria role" );
@@ -12,9 +12,17 @@ test( "accessibility", function() {
        element.progressbar( "value", 77 );
        equal( element.attr( "aria-valuenow" ), 77, "aria-valuenow" );
 
+       element.progressbar( "option", "max", 150 );
+       equal( element.attr( "aria-valuemax" ), 150, "aria-valuemax" );
+
        element.progressbar( "disable" );
        equal( element.attr( "aria-disabled" ), "true", "aria-disabled on" );
 
        element.progressbar( "enable" );
        equal( element.attr( "aria-disabled" ), "false", "aria-disabled off" );
+
+       element.progressbar( "option", "value", false );
+       equal( element.attr( "aria-valuemin" ), 0, "aria-valuemin" );
+       equal( element.attr( "aria-valuemax" ), 150, "aria-valuemax" );
+       strictEqual( element.attr( "aria-valuenow" ), undefined, "aria-valuenow initially" );
 });
index 53c9508edc783b629edc1c8dd7f4ced635e57f3a..348f1d0610313bcb2cf6bfcb9ad347ec4b447bb0 100644 (file)
@@ -33,10 +33,10 @@ $.widget( "ui.progressbar", {
                this.element
                        .addClass( "ui-progressbar ui-widget ui-widget-content ui-corner-all" )
                        .attr({
+                               // Only set static values, aria-valuenow and aria-valuemax are
+                               // set inside _refreshValue()
                                role: "progressbar",
-                               "aria-valuemin": this.min,
-                               "aria-valuemax": this.options.max,
-                               "aria-valuenow": this.options.value
+                               "aria-valuemin": this.min
                        });
 
                this.valueDiv = $( "<div class='ui-progressbar-value ui-widget-header ui-corner-left'></div>" )
@@ -126,7 +126,7 @@ $.widget( "ui.progressbar", {
                        .width( percentage.toFixed(0) + "%" );
 
                if ( this.indeterminate ) {
-                       this.element.removeAttr( "aria-valuemax" ).removeAttr( "aria-valuenow" );
+                       this.element.removeAttr( "aria-valuenow" );
                        if ( !this.overlayDiv ) {
                                this.overlayDiv = $( "<div class='ui-progressbar-overlay'></div>" ).appendTo( this.valueDiv );
                        }