aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorScott González <scott.gonzalez@gmail.com>2012-12-12 11:21:49 -0500
committerScott González <scott.gonzalez@gmail.com>2012-12-12 11:21:49 -0500
commitf5aaf874e9563ef90a1dec35700732acd58e8b43 (patch)
tree6b72d4e98d622a08adbc17c2e57d3d9dd1b81bcc
parent747d8534520fc3abad81b3c171fa931149398d99 (diff)
downloadjquery-ui-f5aaf874e9563ef90a1dec35700732acd58e8b43.tar.gz
jquery-ui-f5aaf874e9563ef90a1dec35700732acd58e8b43.zip
Progressbar: Moved .ui-progressbar-indeterminate to main element. Added tests for markup structure.
-rw-r--r--tests/unit/progressbar/progressbar_core.js25
-rw-r--r--themes/base/jquery.ui.progressbar.css4
-rw-r--r--ui/jquery.ui.progressbar.js3
3 files changed, 29 insertions, 3 deletions
diff --git a/tests/unit/progressbar/progressbar_core.js b/tests/unit/progressbar/progressbar_core.js
index cffd84d21..8f4a138ce 100644
--- a/tests/unit/progressbar/progressbar_core.js
+++ b/tests/unit/progressbar/progressbar_core.js
@@ -1,5 +1,30 @@
module( "progressbar: core" );
+test( "markup structure", function() {
+ expect( 5 );
+ var element = $( "#progressbar" ).progressbar();
+ ok( element.hasClass( "ui-progressbar" ), "main element is .ui-progressbar" );
+ ok( !element.hasClass( "ui-progressbar-indeterminate" ),
+ "main element is not .ui-progressbar-indeterminate" );
+ equal( element.children().length, 1, "main element contains one child" );
+ ok( element.children().eq( 0 ).hasClass( "ui-progressbar-value" ),
+ "child is .ui-progressbar-value" );
+ equal( element.children().children().length, 0, "no overlay div" );
+});
+
+test( "markup structure - indeterminate", function() {
+ expect( 5 );
+ var element = $( "#progressbar" ).progressbar({ value: false });
+ ok( element.hasClass( "ui-progressbar" ), "main element is .ui-progressbar" );
+ ok( element.hasClass( "ui-progressbar-indeterminate" ),
+ "main element is .ui-progressbar-indeterminate" );
+ equal( element.children().length, 1, "main element contains one child" );
+ ok( element.children().eq( 0 ).hasClass( "ui-progressbar-value" ),
+ "child is .ui-progressbar-value" );
+ equal( element.children().children( ".ui-progressbar-overlay" ).length, 1,
+ ".ui-progressbar-value has .ui-progressbar-overlay" );
+});
+
test( "accessibility", function() {
expect( 11 );
var element = $( "#progressbar" ).progressbar();
diff --git a/themes/base/jquery.ui.progressbar.css b/themes/base/jquery.ui.progressbar.css
index 349cc6d72..5d4c35f07 100644
--- a/themes/base/jquery.ui.progressbar.css
+++ b/themes/base/jquery.ui.progressbar.css
@@ -17,12 +17,12 @@
margin: -1px;
height: 100%;
}
-.ui-progressbar .ui-progressbar-value .ui-progressbar-overlay {
+.ui-progressbar .ui-progressbar-overlay {
background: url("images/animated-overlay.gif");
height: 100%;
filter: alpha(opacity=25);
opacity: 0.25;
}
-.ui-progressbar .ui-progressbar-indeterminate {
+.ui-progressbar-indeterminate .ui-progressbar-value {
background-image: none;
}
diff --git a/ui/jquery.ui.progressbar.js b/ui/jquery.ui.progressbar.js
index 163bb06cd..e8b9b911a 100644
--- a/ui/jquery.ui.progressbar.js
+++ b/ui/jquery.ui.progressbar.js
@@ -112,9 +112,10 @@ $.widget( "ui.progressbar", {
this.valueDiv
.toggle( this.indeterminate || value > this.min )
.toggleClass( "ui-corner-right", value === this.options.max )
- .toggleClass( "ui-progressbar-indeterminate", this.indeterminate )
.width( percentage.toFixed(0) + "%" );
+ this.element.toggleClass( "ui-progressbar-indeterminate", this.indeterminate );
+
if ( this.indeterminate ) {
this.element.removeAttr( "aria-valuenow" );
if ( !this.overlayDiv ) {