diff options
author | Alexander Schmitz <arschmitz@gmail.com> | 2014-12-03 11:25:32 -0500 |
---|---|---|
committer | Alexander Schmitz <arschmitz@gmail.com> | 2015-03-11 16:04:48 -0400 |
commit | ea35ded6ed12747d88bf163c3b7fa15506ef521a (patch) | |
tree | 0266e6f4d3753b00f3a818381d80d18d52ad8268 /tests | |
parent | 2ebef69efe96a5b6057bdedd8876a76661bde482 (diff) | |
download | jquery-ui-ea35ded6ed12747d88bf163c3b7fa15506ef521a.tar.gz jquery-ui-ea35ded6ed12747d88bf163c3b7fa15506ef521a.zip |
Progressbar: Add classes option
Ref #7053
Ref gh-1411
Diffstat (limited to 'tests')
-rw-r--r-- | tests/unit/progressbar/progressbar.html | 1 | ||||
-rw-r--r-- | tests/unit/progressbar/progressbar_common.js | 6 | ||||
-rw-r--r-- | tests/unit/progressbar/progressbar_core.js | 42 |
3 files changed, 29 insertions, 20 deletions
diff --git a/tests/unit/progressbar/progressbar.html b/tests/unit/progressbar/progressbar.html index 56a02bcd4..1dae6b666 100644 --- a/tests/unit/progressbar/progressbar.html +++ b/tests/unit/progressbar/progressbar.html @@ -9,6 +9,7 @@ <script src="../../../external/qunit/qunit.js"></script> <script src="../../../external/jquery-simulate/jquery.simulate.js"></script> <script src="../testsuite.js"></script> + <script src="../../../external/qunit-assert-classes/qunit-assert-classes.js"></script> <script> TestHelpers.loadResources({ css: [ "core", "progressbar" ], diff --git a/tests/unit/progressbar/progressbar_common.js b/tests/unit/progressbar/progressbar_common.js index c603b4efd..0608f09f7 100644 --- a/tests/unit/progressbar/progressbar_common.js +++ b/tests/unit/progressbar/progressbar_common.js @@ -1,6 +1,10 @@ TestHelpers.commonWidgetTests( "progressbar", { defaults: { - classes: {}, + classes: { + "ui-progressbar": "ui-corner-all", + "ui-progressbar-value": "ui-corner-left", + "ui-progressbar-complete": "ui-corner-right" + }, disabled: false, max: 100, value: 0, diff --git a/tests/unit/progressbar/progressbar_core.js b/tests/unit/progressbar/progressbar_core.js index 5b9aadc3d..686e93b43 100644 --- a/tests/unit/progressbar/progressbar_core.js +++ b/tests/unit/progressbar/progressbar_core.js @@ -2,29 +2,33 @@ 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" ); +test( "markup structure", function( assert ) { + expect( 7 ); + var element = $( "#progressbar" ).progressbar(), + value = element.children().eq( 0 ); + + assert.hasClasses( element, "ui-progressbar ui-widget ui-widget-content" ); + assert.hasClasses( value, "ui-progressbar-value ui-widget-header" ); + assert.lacksClasses( value, "ui-progressbar-complete" ); + assert.lacksClasses( element, "ui-progressbar-indeterminate" ); + equal( element.children().length, 1, "Main element contains one child" ); + + element.progressbar( "option", "value", 100 ); + assert.hasClasses( value, "ui-progressbar-complete ui-widget-header ui-progressbar-value" ); equal( element.children().children().length, 0, "no overlay div" ); }); -test( "markup structure - indeterminate", function() { +test( "markup structure - indeterminate", function( assert ) { 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" ); + var element = $( "#progressbar" ).progressbar({ value: false }), + children = element.children(); + + assert.hasClasses( element, "ui-progressbar ui-progressbar-indeterminate ui-widget ui-widget-content" ); + assert.hasClasses( children[ 0 ], "ui-progressbar-value ui-widget-header" ); + equal( children.length, 1, "Main element contains one child" ); + assert.hasClasses( children[ 0 ], "ui-progressbar-value" ); + equal( children.children( ".ui-progressbar-overlay" ).length, 1, + "Value has class ui-progressbar-overlay" ); }); test( "accessibility", function() { |