]> source.dussan.org Git - jquery-ui.git/commitdiff
Progressbar: Moved .ui-progressbar-indeterminate to main element. Added tests for...
authorScott González <scott.gonzalez@gmail.com>
Wed, 12 Dec 2012 16:21:49 +0000 (11:21 -0500)
committerScott González <scott.gonzalez@gmail.com>
Wed, 12 Dec 2012 16:21:49 +0000 (11:21 -0500)
tests/unit/progressbar/progressbar_core.js
themes/base/jquery.ui.progressbar.css
ui/jquery.ui.progressbar.js

index cffd84d2111865dde2c6be4ca954439ba2cc4b84..8f4a138ce9c8e5a720b121fa2a997cbbcc7207c4 100644 (file)
@@ -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();
index 349cc6d720a113b6636e18b5bea3cf768e66b55d..5d4c35f07e30e6ba090bba7c03fdc30ccc210809 100644 (file)
        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;
 }
index 163bb06cd0fc013fc8fbd8e9f226325cc378d54d..e8b9b911a6d17e743dfd5ce3e81ccc4c941cfe0b 100644 (file)
@@ -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 ) {