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

tests/lib/bootstrap.js
tests/unit/spinner/spinner.html
tests/unit/spinner/spinner_common.js
tests/unit/spinner/spinner_core.js
tests/unit/spinner/spinner_events.js
tests/unit/spinner/spinner_methods.js
tests/unit/spinner/spinner_options.js
tests/unit/spinner/spinner_test_helpers.js

index c5e52057eef3d20b327609e1949ba4bd11af4585..94954ba3962056cd3e20ddfda3d43e157dfde685 100644 (file)
@@ -2,6 +2,8 @@
 
 window.requirejs = {
        paths: {
+               "globalize": "../../../external/globalize/globalize",
+               "globalize/ja-JP": "../../../external/globalize/globalize.culture.ja-JP",
                "jquery": jqueryUrl(),
                "jquery-simulate": "../../../external/jquery-simulate/jquery.simulate",
                "jshint": "../../../external/jshint/jshint",
@@ -12,6 +14,7 @@ window.requirejs = {
                "ui": "../../../ui"
        },
        shim: {
+               "globalize/ja-JP": [ "globalize" ],
                "jquery-simulate": [ "jquery" ],
                "qunit-assert-classes": [ "qunit" ]
        }
index c427f5de55c92dd1f059ea1baef2c7265bfb11fc..43ded34a722c68964deb3e4a53ca95b31fb75e3a 100644 (file)
@@ -4,34 +4,8 @@
        <meta charset="utf-8">
        <title>jQuery UI Spinner Test Suite</title>
 
-       <script src="../../jquery.js"></script>
-       <script src="../../../external/globalize/globalize.js"></script>
-       <script src="../../../external/globalize/globalize.culture.ja-JP.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", "button", "spinner" ],
-               js: [
-                       "ui/core.js",
-                       "ui/widget.js",
-                       "ui/button.js",
-                       "ui/spinner.js"
-               ]
-       });
-       </script>
-
-       <script src="spinner_test_helpers.js"></script>
-       <script src="spinner_common.js"></script>
-       <script src="spinner_core.js"></script>
-       <script src="spinner_events.js"></script>
-       <script src="spinner_methods.js"></script>
-       <script src="spinner_options.js"></script>
-
-       <script src="../swarminject.js"></script>
+       <script src="../../lib/css.js" data-modules="core button spinner"></script>
+       <script src="../../lib/bootstrap.js" data-widget="spinner"></script>
 </head>
 <body>
 
index 3eee4f9f07643f6ecdbfa1b8b3b2b5cd0545331c..2c40df76abb5dfb88a1e35382c49134cc4037dcf 100644 (file)
@@ -1,4 +1,9 @@
-TestHelpers.commonWidgetTests( "spinner", {
+define( [
+       "lib/common",
+       "ui/spinner"
+], function( common ) {
+
+common.testWidget( "spinner", {
        defaults: {
                classes: {
                        "ui-spinner": "ui-corner-all",
@@ -26,3 +31,5 @@ TestHelpers.commonWidgetTests( "spinner", {
                stop: null
        }
 });
+
+} );
index b3e1e6d235757e291d0f31eebcedd0828d9de254..5faa733c35f431f237a7aa3fb8e5aa885ec99369 100644 (file)
@@ -1,6 +1,10 @@
-(function( $ ) {
+define( [
+       "jquery",
+       "./spinner_test_helpers",
+       "ui/spinner"
+], function( $, spinnerTestHelpers ) {
 
-var simulateKeyDownUp = TestHelpers.spinner.simulateKeyDownUp;
+var simulateKeyDownUp = spinnerTestHelpers.simulateKeyDownUp;
 
 module( "spinner: core" );
 
@@ -250,4 +254,4 @@ test( "precision", function() {
        equal( element.val(), "0.05", "precision from min" );
 });
 
-})( jQuery );
+} );
index 007d34cf77091b2a6b7d2efd3f238542a4dd1da1..05d1efe1b72432566a76b12be53a10c9f3faf3c6 100644 (file)
@@ -1,6 +1,10 @@
-(function( $ ) {
+define( [
+       "jquery",
+       "./spinner_test_helpers",
+       "ui/spinner"
+], function( $, spinnerTestHelpers ) {
 
-var simulateKeyDownUp = TestHelpers.spinner.simulateKeyDownUp;
+var simulateKeyDownUp = spinnerTestHelpers.simulateKeyDownUp;
 
 module( "spinner: events" );
 
@@ -256,4 +260,4 @@ asyncTest( "change", function() {
        setTimeout( step1 );
 });
 
-})( jQuery );
+} );
index 61ff21d1ca206ef6e50946a71a7b03a9908f467e..3f88a9e9c7f39ea44795f2889b10bcadfb77b47b 100644 (file)
@@ -1,12 +1,16 @@
-(function( $ ) {
+define( [
+       "jquery",
+       "./spinner_test_helpers",
+       "ui/spinner"
+], function( $, spinnerTestHelpers ) {
 
-var simulateKeyDownUp = TestHelpers.spinner.simulateKeyDownUp;
+var simulateKeyDownUp = spinnerTestHelpers.simulateKeyDownUp;
 
 module( "spinner: methods" );
 
-test( "destroy", function() {
+test( "destroy", function( assert ) {
        expect( 1 );
-       domEqual( "#spin", function() {
+       assert.domEqual( "#spin", function() {
                $( "#spin" ).spinner().spinner( "destroy" );
        });
 });
@@ -204,4 +208,4 @@ test( "widget", function() {
        strictEqual( widgetElement[ 0 ], element.parent()[ 0 ], "parent element" );
 });
 
-})( jQuery );
+} );
index 160b600c688845059f562d10202f107a0cdef70d..f8d9ad39695f446f8fb8855789ec5e51edf672e7 100644 (file)
@@ -1,4 +1,9 @@
-(function( $ ) {
+define( [
+       "jquery",
+       "ui/spinner",
+       "globalize",
+       "globalize/ja-JP"
+], function( $ ) {
 
 module( "spinner: options" );
 
@@ -263,4 +268,4 @@ test( "step, string", function() {
        equal( element.val(), "$0.70", "stepUp" );
 });
 
-})( jQuery );
+} );
index 9b11cf6325f16ba2ae8ad8d7df5b3a1bf6f45bd6..9ed904ff451b85ece115ac99b92228e5d1126898 100644 (file)
@@ -1,7 +1,11 @@
-TestHelpers.spinner = {
+define( function() {
+
+return {
        simulateKeyDownUp: function( element, keyCode, shift ) {
                element
                        .simulate( "keydown", { keyCode: keyCode, shiftKey: shift || false } )
                        .simulate( "keyup", { keyCode: keyCode, shiftKey: shift || false } );
        }
 };
+
+} );