diff options
author | Scott González <scott.gonzalez@gmail.com> | 2015-04-06 14:44:05 -0400 |
---|---|---|
committer | Scott González <scott.gonzalez@gmail.com> | 2015-04-09 09:26:26 -0400 |
commit | a856dd9b7e00982cbe4dc9a2dce8ca940728126d (patch) | |
tree | ec04e7537281d62a99f3d161187d7a2075f7280e | |
parent | 3522fd9618d196beb235f3bd52f85c31f20c57b8 (diff) | |
download | jquery-ui-a856dd9b7e00982cbe4dc9a2dce8ca940728126d.tar.gz jquery-ui-a856dd9b7e00982cbe4dc9a2dce8ca940728126d.zip |
Slider: Convert tests to new infrastructure
Ref #10119
Ref gh-1528
-rw-r--r-- | tests/unit/slider/slider.html | 27 | ||||
-rw-r--r-- | tests/unit/slider/slider_common.js | 9 | ||||
-rw-r--r-- | tests/unit/slider/slider_core.js | 10 | ||||
-rw-r--r-- | tests/unit/slider/slider_events.js | 7 | ||||
-rw-r--r-- | tests/unit/slider/slider_methods.js | 11 | ||||
-rw-r--r-- | tests/unit/slider/slider_options.js | 11 |
6 files changed, 34 insertions, 41 deletions
diff --git a/tests/unit/slider/slider.html b/tests/unit/slider/slider.html index 38520c073..f19085fd4 100644 --- a/tests/unit/slider/slider.html +++ b/tests/unit/slider/slider.html @@ -4,31 +4,8 @@ <meta charset="utf-8"> <title>jQuery UI Slider Test Suite</title> - <script src="../../jquery.js"></script> - <link rel="stylesheet" href="../../../external/qunit/qunit.css"> - <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", "slider" ], - js: [ - "ui/core.js", - "ui/widget.js", - "ui/mouse.js", - "ui/slider.js" - ] - }); - </script> - - <script src="slider_common.js"></script> - <script src="slider_core.js"></script> - <script src="slider_events.js"></script> - <script src="slider_methods.js"></script> - <script src="slider_options.js"></script> - - <script src="../swarminject.js"></script> + <script src="../../lib/css.js" data-modules="core slider"></script> + <script src="../../lib/bootstrap.js" data-widget="slider"></script> </head> <body> diff --git a/tests/unit/slider/slider_common.js b/tests/unit/slider/slider_common.js index c4033e8a9..77004d159 100644 --- a/tests/unit/slider/slider_common.js +++ b/tests/unit/slider/slider_common.js @@ -1,4 +1,9 @@ -TestHelpers.commonWidgetTests( "slider", { +define( [ + "lib/common", + "ui/slider" +], function( common ) { + +common.testWidget( "slider", { defaults: { animate: false, cancel: "input, textarea, button, select, option", @@ -26,3 +31,5 @@ TestHelpers.commonWidgetTests( "slider", { stop: null } }); + +} ); diff --git a/tests/unit/slider/slider_core.js b/tests/unit/slider/slider_core.js index fa86b2df4..797d5525c 100644 --- a/tests/unit/slider/slider_core.js +++ b/tests/unit/slider/slider_core.js @@ -1,7 +1,7 @@ -(function( $ ) { -// -// Slider Test Helper Functions -// +define( [ + "jquery", + "ui/slider" +], function( $ ) { var element, options; @@ -306,4 +306,4 @@ test( "keydown LEFT on handle decreases value by step, not less than min", funct element.slider( "destroy" ); }); -})( jQuery ); +} ); diff --git a/tests/unit/slider/slider_events.js b/tests/unit/slider/slider_events.js index cc5546a9f..0d22577f1 100644 --- a/tests/unit/slider/slider_events.js +++ b/tests/unit/slider/slider_events.js @@ -1,4 +1,7 @@ -(function( $ ) { +define( [ + "jquery", + "ui/slider" +], function( $ ) { module( "slider: events" ); @@ -202,4 +205,4 @@ test( "event data", function() { handles.eq( slideHandleIndex ).simulate( "drag", { dx: 10 } ); }); -})( jQuery ); +} ); diff --git a/tests/unit/slider/slider_methods.js b/tests/unit/slider/slider_methods.js index d2ef1d9ce..bddafefca 100644 --- a/tests/unit/slider/slider_methods.js +++ b/tests/unit/slider/slider_methods.js @@ -1,4 +1,7 @@ -(function( $ ) { +define( [ + "jquery", + "ui/slider" +], function( $ ) { module( "slider: methods" ); @@ -23,9 +26,9 @@ test( "init", function() { ok( true, "arbitrary option setter after init" ); }); -test( "destroy", function() { +test( "destroy", function( assert ) { expect( 1 ); - domEqual( "#slider1", function() { + assert.domEqual( "#slider1", function() { $( "#slider1" ).slider().slider( "destroy" ); }); }); @@ -110,4 +113,4 @@ test( "value", function() { // ok(false, "missing test - untested code is broken code." ); //}); -})( jQuery ); +} ); diff --git a/tests/unit/slider/slider_options.js b/tests/unit/slider/slider_options.js index dedfe78d3..923c3c1c9 100644 --- a/tests/unit/slider/slider_options.js +++ b/tests/unit/slider/slider_options.js @@ -1,4 +1,7 @@ -(function( $ ) { +define( [ + "jquery", + "ui/slider" +], function( $ ) { var element, options; @@ -54,7 +57,7 @@ test( "max", function() { element.slider( options ); ok( element.slider( "option", "value" ) === options.value, "value option is not contained by max" ); ok( element.slider( "value" ) === options.max, "value method is contained by max" ); - + options = { max: 9, min: 1, @@ -65,7 +68,7 @@ test( "max", function() { element.slider( options ); ok( element.slider( "value" ) === 7, "value method is within max, edge Case" ); - + options.step = 2; element.slider( options ); @@ -343,4 +346,4 @@ test( "range", function( assert ) { element.slider( "destroy" ); }); -})( jQuery ); +} ); |