diff options
author | Scott González <scott.gonzalez@gmail.com> | 2015-04-03 15:24:09 -0400 |
---|---|---|
committer | Scott González <scott.gonzalez@gmail.com> | 2015-04-09 09:24:45 -0400 |
commit | e39ee9d6695cebd4ec138b1d5391c67c58d939a9 (patch) | |
tree | 12117ad7f9c49da54fe7e0d17338fe7cf731222d /tests/unit/accordion | |
parent | 2e1c72fb59b3e41da15ebcd83640dbdf13a90d27 (diff) | |
download | jquery-ui-e39ee9d6695cebd4ec138b1d5391c67c58d939a9.tar.gz jquery-ui-e39ee9d6695cebd4ec138b1d5391c67c58d939a9.zip |
Accordion: Convert tests to new infrastructure
Ref #10119
Ref gh-1528
Diffstat (limited to 'tests/unit/accordion')
-rw-r--r-- | tests/unit/accordion/accordion.html | 27 | ||||
-rw-r--r-- | tests/unit/accordion/accordion_common.js | 9 | ||||
-rw-r--r-- | tests/unit/accordion/accordion_core.js | 12 | ||||
-rw-r--r-- | tests/unit/accordion/accordion_events.js | 12 | ||||
-rw-r--r-- | tests/unit/accordion/accordion_methods.js | 18 | ||||
-rw-r--r-- | tests/unit/accordion/accordion_options.js | 14 | ||||
-rw-r--r-- | tests/unit/accordion/accordion_test_helpers.js | 11 |
7 files changed, 54 insertions, 49 deletions
diff --git a/tests/unit/accordion/accordion.html b/tests/unit/accordion/accordion.html index 9ea2d3645..db206a2e5 100644 --- a/tests/unit/accordion/accordion.html +++ b/tests/unit/accordion/accordion.html @@ -4,31 +4,8 @@ <meta charset="utf-8"> <title>jQuery UI Accordion 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", "accordion" ], - js: [ - "ui/core.js", - "ui/widget.js", - "ui/accordion.js" - ] - }); - </script> - - <script src="accordion_test_helpers.js"></script> - <script src="accordion_common.js"></script> - <script src="accordion_core.js"></script> - <script src="accordion_events.js"></script> - <script src="accordion_methods.js"></script> - <script src="accordion_options.js"></script> - - <script src="../swarminject.js"></script> + <script src="../../lib/css.js" data-modules="core accordion"></script> + <script src="../../lib/bootstrap.js" data-widget="accordion"></script> <style> #list, #list1 *, #navigation, #navigation * { margin: 0; diff --git a/tests/unit/accordion/accordion_common.js b/tests/unit/accordion/accordion_common.js index 0971bce3c..8a859f0ca 100644 --- a/tests/unit/accordion/accordion_common.js +++ b/tests/unit/accordion/accordion_common.js @@ -1,4 +1,9 @@ -TestHelpers.commonWidgetTests( "accordion", { +define( [ + "lib/common", + "ui/accordion" +], function( common ) { + +common.testWidget( "accordion", { defaults: { active: 0, animate: {}, @@ -23,3 +28,5 @@ TestHelpers.commonWidgetTests( "accordion", { create: null } }); + +} ); diff --git a/tests/unit/accordion/accordion_core.js b/tests/unit/accordion/accordion_core.js index 155cad7c8..474943098 100644 --- a/tests/unit/accordion/accordion_core.js +++ b/tests/unit/accordion/accordion_core.js @@ -1,7 +1,11 @@ -(function( $ ) { +define( [ + "jquery", + "./accordion_test_helpers", + "ui/accordion" +], function( $, accordionTestHelper ) { -var setupTeardown = TestHelpers.accordion.setupTeardown, - state = TestHelpers.accordion.state; +var setupTeardown = accordionTestHelper.setupTeardown, + state = accordionTestHelper.state; module( "accordion: core", setupTeardown() ); @@ -200,4 +204,4 @@ asyncTest( "keyboard support", function( assert ) { } }); -}( jQuery ) ); +} ); diff --git a/tests/unit/accordion/accordion_events.js b/tests/unit/accordion/accordion_events.js index 5f6cfa8bc..05dc144b4 100644 --- a/tests/unit/accordion/accordion_events.js +++ b/tests/unit/accordion/accordion_events.js @@ -1,7 +1,11 @@ -(function( $ ) { +define( [ + "jquery", + "./accordion_test_helpers", + "ui/accordion" +], function( $, accordionTestHelper ) { -var setupTeardown = TestHelpers.accordion.setupTeardown, - state = TestHelpers.accordion.state; +var setupTeardown = accordionTestHelper.setupTeardown, + state = accordionTestHelper.state; module( "accordion: events", setupTeardown() ); @@ -161,4 +165,4 @@ test( "activate", function() { element.accordion( "option", "active", 1 ); }); -}( jQuery ) ); +} ); diff --git a/tests/unit/accordion/accordion_methods.js b/tests/unit/accordion/accordion_methods.js index b59926332..5fdb115c6 100644 --- a/tests/unit/accordion/accordion_methods.js +++ b/tests/unit/accordion/accordion_methods.js @@ -1,14 +1,18 @@ -(function( $ ) { +define( [ + "jquery", + "./accordion_test_helpers", + "ui/accordion" +], function( $, accordionTestHelper ) { -var equalHeight = TestHelpers.accordion.equalHeight, - setupTeardown = TestHelpers.accordion.setupTeardown, - state = TestHelpers.accordion.state; +var equalHeight = accordionTestHelper.equalHeight, + setupTeardown = accordionTestHelper.setupTeardown, + state = accordionTestHelper.state; module( "accordion: methods", setupTeardown() ); -test( "destroy", function() { +test( "destroy", function( assert ) { expect( 1 ); - domEqual( "#list1", function() { + assert.domEqual( "#list1", function() { $( "#list1" ).accordion().accordion( "destroy" ); }); }); @@ -129,4 +133,4 @@ test( "widget", function() { strictEqual( widgetElement[ 0 ], element[ 0 ], "same element" ); }); -}( jQuery ) ); +} ); diff --git a/tests/unit/accordion/accordion_options.js b/tests/unit/accordion/accordion_options.js index 689c6face..3235057dc 100644 --- a/tests/unit/accordion/accordion_options.js +++ b/tests/unit/accordion/accordion_options.js @@ -1,8 +1,12 @@ -(function( $ ) { +define( [ + "jquery", + "./accordion_test_helpers", + "ui/accordion" +], function( $, accordionTestHelper ) { -var equalHeight = TestHelpers.accordion.equalHeight, - setupTeardown = TestHelpers.accordion.setupTeardown, - state = TestHelpers.accordion.state; +var equalHeight = accordionTestHelper.equalHeight, + setupTeardown = accordionTestHelper.setupTeardown, + state = accordionTestHelper.state; module( "accordion: options", setupTeardown() ); @@ -460,4 +464,4 @@ test( "{ icons: hash }", function( assert ) { assert.hasClasses( element.find( ".ui-accordion-header.ui-state-active span.ui-icon" ), "a2" ); }); -}( jQuery ) ); +} ); diff --git a/tests/unit/accordion/accordion_test_helpers.js b/tests/unit/accordion/accordion_test_helpers.js index 643f8e283..ec1190f16 100644 --- a/tests/unit/accordion/accordion_test_helpers.js +++ b/tests/unit/accordion/accordion_test_helpers.js @@ -1,4 +1,6 @@ -TestHelpers.accordion = { +define( function() { + +return { equalHeight: function( accordion, height ) { accordion.find( ".ui-accordion-content" ).each(function() { equal( $( this ).outerHeight(), height ); @@ -20,8 +22,11 @@ TestHelpers.accordion = { state: function( accordion ) { var expected = $.makeArray( arguments ).slice( 1 ), actual = accordion.find( ".ui-accordion-content" ).map(function() { - return $( this ).css( "display" ) === "none" ? 0 : 1; - }).get(); + return $( this ).css( "display" ) === "none" ? 0 : 1; + }).get(); QUnit.push( QUnit.equiv(actual, expected), actual, expected ); } + }; + +} ); |