]> source.dussan.org Git - jquery-ui.git/commitdiff
Slider: Convert tests to new infrastructure
authorScott González <scott.gonzalez@gmail.com>
Mon, 6 Apr 2015 18:44:05 +0000 (14:44 -0400)
committerScott González <scott.gonzalez@gmail.com>
Thu, 9 Apr 2015 13:26:26 +0000 (09:26 -0400)
Ref #10119
Ref gh-1528

tests/unit/slider/slider.html
tests/unit/slider/slider_common.js
tests/unit/slider/slider_core.js
tests/unit/slider/slider_events.js
tests/unit/slider/slider_methods.js
tests/unit/slider/slider_options.js

index 38520c0730a0bb2b6055acb119639b738665350f..f19085fd46ecc022e4ba6a1580b9b58e8b80131e 100644 (file)
@@ -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>
 
index c4033e8a997106f8e5815e8ef2c6d7d3b6c8456b..77004d159d857348a06fb0bb870ba4c12e5e74c2 100644 (file)
@@ -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
        }
 });
+
+} );
index fa86b2df46125ee325883d35a838cf4d7aa59b39..797d5525c88d832ff7a5caba076bc9b6088275fc 100644 (file)
@@ -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 );
+} );
index cc5546a9f6f406dd82741a1cbb938a8bfa56908f..0d22577f128787bfd9d04a44f38dfc3ecfbf258b 100644 (file)
@@ -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 );
+} );
index d2ef1d9cebc2910fa57bb7c124cc36d0c025bf71..bddafefca54ff7a84d1f544cc47c8ed32e601c73 100644 (file)
@@ -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 );
+} );
index dedfe78d3e63619f70cee08a0d0d183a78d2c888..923c3c1c9af5cd438532efbac6d5edd2037f4881 100644 (file)
@@ -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 );
+} );