diff options
author | Felix Nagel <info@felixnagel.com> | 2012-08-30 22:57:37 +0200 |
---|---|---|
committer | Felix Nagel <info@felixnagel.com> | 2012-08-30 22:57:37 +0200 |
commit | daadc84416d22eca651c85627d5dd683d7727d3e (patch) | |
tree | c52b8c3e89336d4d91e5a4aac8c298d472312c7a /tests/unit | |
parent | c1799024684780995ba666aa1c9acfa34c69f12a (diff) | |
parent | dec9c54632be191947c310b402810cf6f1b4250a (diff) | |
download | jquery-ui-daadc84416d22eca651c85627d5dd683d7727d3e.tar.gz jquery-ui-daadc84416d22eca651c85627d5dd683d7727d3e.zip |
Merge branch 'master' into selectmenu
Diffstat (limited to 'tests/unit')
33 files changed, 118 insertions, 53 deletions
diff --git a/tests/unit/accordion/accordion_methods.js b/tests/unit/accordion/accordion_methods.js index 8723bcbb7..f8f556fa7 100644 --- a/tests/unit/accordion/accordion_methods.js +++ b/tests/unit/accordion/accordion_methods.js @@ -45,4 +45,12 @@ test( "refresh", function() { equalHeight( element, 455 ); }); +test( "widget", function() { + expect( 2 ); + var element = $( "#list1" ).accordion(), + widgetElement = element.accordion( "widget" ); + equal( widgetElement.length, 1, "one element" ); + strictEqual( widgetElement[ 0 ], element[ 0 ], "same element" ); +}); + }( jQuery ) ); diff --git a/tests/unit/accordion/all.html b/tests/unit/accordion/all.html index 2fb783c1c..a40ec47ed 100644 --- a/tests/unit/accordion/all.html +++ b/tests/unit/accordion/all.html @@ -4,7 +4,7 @@ <meta charset="utf-8"> <title>jQuery UI Accordion Test Suite</title> - <script src="../../../jquery-1.7.2.js"></script> + <script src="../../../jquery-1.8.0.js"></script> <link rel="stylesheet" href="../../../external/qunit.css"> <link rel="stylesheet" href="../qunit-composite.css"> diff --git a/tests/unit/all-active.html b/tests/unit/all-active.html index b3e2fbcba..5095e354c 100644 --- a/tests/unit/all-active.html +++ b/tests/unit/all-active.html @@ -4,7 +4,7 @@ <meta charset="utf-8"> <title>jQuery UI Test Suite</title> - <script src="../../jquery-1.7.2.js"></script> + <script src="../../jquery-1.8.0.js"></script> <link rel="stylesheet" href="../../external/qunit.css"> <link rel="stylesheet" href="qunit-composite.css"> diff --git a/tests/unit/all.html b/tests/unit/all.html index 6d98df0f9..80da77e50 100644 --- a/tests/unit/all.html +++ b/tests/unit/all.html @@ -4,7 +4,7 @@ <meta charset="utf-8"> <title>jQuery UI Test Suite</title> - <script src="../../jquery-1.7.2.js"></script> + <script src="../../jquery-1.8.0.js"></script> <link rel="stylesheet" href="../../external/qunit.css"> <link rel="stylesheet" href="qunit-composite.css"> diff --git a/tests/unit/autocomplete/all.html b/tests/unit/autocomplete/all.html index e35777f65..3fa793b85 100644 --- a/tests/unit/autocomplete/all.html +++ b/tests/unit/autocomplete/all.html @@ -4,7 +4,7 @@ <meta charset="utf-8"> <title>jQuery UI Autocomplete Test Suite</title> - <script src="../../../jquery-1.7.2.js"></script> + <script src="../../../jquery-1.8.0.js"></script> <link rel="stylesheet" href="../../../external/qunit.css"> <link rel="stylesheet" href="../qunit-composite.css"> diff --git a/tests/unit/autocomplete/autocomplete_methods.js b/tests/unit/autocomplete/autocomplete_methods.js index 1600d73dc..1bfa10554 100644 --- a/tests/unit/autocomplete/autocomplete_methods.js +++ b/tests/unit/autocomplete/autocomplete_methods.js @@ -34,4 +34,12 @@ test( "search, close", function() { ok( menu.is( ":hidden" ), "menu is hidden after close" ); }); +test( "widget", function() { + expect( 2 ); + var element = $( "#autocomplete" ).autocomplete(), + widgetElement = element.autocomplete( "widget" ); + equal( widgetElement.length, 1, "one element" ); + ok( widgetElement.is( ".ui-menu" ), "menu element" ); +}); + }( jQuery ) ); diff --git a/tests/unit/button/all.html b/tests/unit/button/all.html index 6c46c9650..21d11fce2 100644 --- a/tests/unit/button/all.html +++ b/tests/unit/button/all.html @@ -4,7 +4,7 @@ <meta charset="utf-8"> <title>jQuery UI Button Test Suite</title> - <script src="../../../jquery-1.7.2.js"></script> + <script src="../../../jquery-1.8.0.js"></script> <link rel="stylesheet" href="../../../external/qunit.css"> <link rel="stylesheet" href="../qunit-composite.css"> diff --git a/tests/unit/core/all.html b/tests/unit/core/all.html index e31d6905c..eafa22f05 100644 --- a/tests/unit/core/all.html +++ b/tests/unit/core/all.html @@ -4,7 +4,7 @@ <meta charset="utf-8"> <title>jQuery UI Core Test Suite</title> - <script src="../../../jquery-1.7.2.js"></script> + <script src="../../../jquery-1.8.0.js"></script> <link rel="stylesheet" href="../../../external/qunit.css"> <link rel="stylesheet" href="../qunit-composite.css"> diff --git a/tests/unit/datepicker/all.html b/tests/unit/datepicker/all.html index c62c7c07d..153704c04 100644 --- a/tests/unit/datepicker/all.html +++ b/tests/unit/datepicker/all.html @@ -4,7 +4,7 @@ <meta charset="utf-8"> <title>jQuery UI Datepicker Test Suite</title> - <script src="../../../jquery-1.7.2.js"></script> + <script src="../../../jquery-1.8.0.js"></script> <link rel="stylesheet" href="../../../external/qunit.css"> <link rel="stylesheet" href="../qunit-composite.css"> diff --git a/tests/unit/dialog/all.html b/tests/unit/dialog/all.html index b1c69c6c9..bf563ebe6 100644 --- a/tests/unit/dialog/all.html +++ b/tests/unit/dialog/all.html @@ -4,7 +4,7 @@ <meta charset="utf-8"> <title>jQuery UI Dialog Test Suite</title> - <script src="../../../jquery-1.7.2.js"></script> + <script src="../../../jquery-1.8.0.js"></script> <link rel="stylesheet" href="../../../external/qunit.css"> <link rel="stylesheet" href="../qunit-composite.css"> diff --git a/tests/unit/draggable/all.html b/tests/unit/draggable/all.html index 75df351ad..dc0ad95ee 100644 --- a/tests/unit/draggable/all.html +++ b/tests/unit/draggable/all.html @@ -4,7 +4,7 @@ <meta charset="utf-8"> <title>jQuery UI Draggable Test Suite</title> - <script src="../../../jquery-1.7.2.js"></script> + <script src="../../../jquery-1.8.0.js"></script> <link rel="stylesheet" href="../../../external/qunit.css"> <link rel="stylesheet" href="../qunit-composite.css"> diff --git a/tests/unit/droppable/all.html b/tests/unit/droppable/all.html index aa24ed7e1..a8e3a945e 100644 --- a/tests/unit/droppable/all.html +++ b/tests/unit/droppable/all.html @@ -4,7 +4,7 @@ <meta charset="utf-8"> <title>jQuery UI Droppable Test Suite</title> - <script src="../../../jquery-1.7.2.js"></script> + <script src="../../../jquery-1.8.0.js"></script> <link rel="stylesheet" href="../../../external/qunit.css"> <link rel="stylesheet" href="../qunit-composite.css"> diff --git a/tests/unit/effects/all.html b/tests/unit/effects/all.html index 59500588c..e7d41dd13 100644 --- a/tests/unit/effects/all.html +++ b/tests/unit/effects/all.html @@ -4,7 +4,7 @@ <meta charset="utf-8"> <title>jQuery UI Effects Test Suite</title> - <script src="../../../jquery-1.7.2.js"></script> + <script src="../../../jquery-1.8.0.js"></script> <link rel="stylesheet" href="../../../external/qunit.css"> <link rel="stylesheet" href="../qunit-composite.css"> diff --git a/tests/unit/index.html b/tests/unit/index.html index 33a326370..6979ef83b 100644 --- a/tests/unit/index.html +++ b/tests/unit/index.html @@ -7,7 +7,7 @@ <link rel="stylesheet" href="../../themes/base/jquery.ui.core.css"> <link rel="stylesheet" href="../../themes/base/jquery.ui.theme.css"> <link rel="stylesheet" href="../index.css"> - <script src="../jquery-1.7.2.js"></script> + <script src="../jquery-1.8.0.js"></script> <script src="../index.js"></script> </head> <body> diff --git a/tests/unit/menu/all.html b/tests/unit/menu/all.html index 475c1b717..7025efce6 100644 --- a/tests/unit/menu/all.html +++ b/tests/unit/menu/all.html @@ -4,7 +4,7 @@ <meta charset="utf-8"> <title>jQuery UI Menu Test Suite</title> - <script src="../../../jquery-1.7.2.js"></script> + <script src="../../../jquery-1.8.0.js"></script> <link rel="stylesheet" href="../../../external/qunit.css"> <link rel="stylesheet" href="../qunit-composite.css"> diff --git a/tests/unit/menu/menu_methods.js b/tests/unit/menu/menu_methods.js index 510ddb1d7..f9241f27b 100644 --- a/tests/unit/menu/menu_methods.js +++ b/tests/unit/menu/menu_methods.js @@ -10,6 +10,22 @@ module( "menu: methods", { } }); +test( "destroy", function() { + expect( 4 ); + domEqual( "#menu1", function() { + $( "#menu1" ).menu().menu( "destroy" ); + }); + domEqual( "#menu2", function() { + $( "#menu2" ).menu().menu( "destroy" ); + }); + domEqual( "#menu5", function() { + $( "#menu5").menu().menu( "destroy" ); + }); + domEqual( "#menu6", function() { + $( "#menu6" ).menu().menu( "destroy" ); + }); +}); + test( "enable/disable", function() { expect( 3 ); var element = $( "#menu1" ).menu({ @@ -44,6 +60,14 @@ test( "refresh", function() { equal( element.find( ".ui-menu-item" ).length, 5, "Incorrect number of menu items" ); }); +test( "widget", function() { + expect( 2 ); + var element = $( "#menu1" ).menu(), + widgetElement = element.menu( "widget" ); + equal( widgetElement.length, 1, "one element" ); + strictEqual( widgetElement[ 0 ], element[ 0 ], "same element" ); +}); + // TODO: test focus method // TODO: test blur method @@ -68,20 +92,4 @@ test( "refresh", function() { // TODO: test select method -test( "destroy", function() { - expect( 4 ); - domEqual( "#menu1", function() { - $( "#menu1" ).menu().menu( "destroy" ); - }); - domEqual( "#menu2", function() { - $( "#menu2" ).menu().menu( "destroy" ); - }); - domEqual( "#menu5", function() { - $( "#menu5").menu().menu( "destroy" ); - }); - domEqual( "#menu6", function() { - $( "#menu6" ).menu().menu( "destroy" ); - }); -}); - })( jQuery ); diff --git a/tests/unit/position/all.html b/tests/unit/position/all.html index d76f9bbd8..138c0cd89 100644 --- a/tests/unit/position/all.html +++ b/tests/unit/position/all.html @@ -4,7 +4,7 @@ <meta charset="utf-8"> <title>jQuery UI Position Test Suite</title> - <script src="../../../jquery-1.7.2.js"></script> + <script src="../../../jquery-1.8.0.js"></script> <link rel="stylesheet" href="../../../external/qunit.css"> <link rel="stylesheet" href="../qunit-composite.css"> diff --git a/tests/unit/progressbar/all.html b/tests/unit/progressbar/all.html index 16b9e0ace..ca611b068 100644 --- a/tests/unit/progressbar/all.html +++ b/tests/unit/progressbar/all.html @@ -4,7 +4,7 @@ <meta charset="utf-8"> <title>jQuery UI Progressbar Test Suite</title> - <script src="../../../jquery-1.7.2.js"></script> + <script src="../../../jquery-1.8.0.js"></script> <link rel="stylesheet" href="../../../external/qunit.css"> <link rel="stylesheet" href="../qunit-composite.css"> diff --git a/tests/unit/progressbar/progressbar_methods.js b/tests/unit/progressbar/progressbar_methods.js index 89478b9b1..990739c6e 100644 --- a/tests/unit/progressbar/progressbar_methods.js +++ b/tests/unit/progressbar/progressbar_methods.js @@ -15,3 +15,11 @@ test( "value", function() { equal( element.progressbar( "value", 30), element, "chainable as setter" ); equal( element.progressbar( "option", "value" ), 30, "correct value after setter" ); }); + +test( "widget", function() { + expect( 2 ); + var element = $( "#progressbar" ).progressbar(), + widgetElement = element.progressbar( "widget" ); + equal( widgetElement.length, 1, "one element" ); + strictEqual( widgetElement[ 0 ], element[ 0 ], "same element" ); +}); diff --git a/tests/unit/resizable/all.html b/tests/unit/resizable/all.html index bef29ff6e..d349d1e68 100644 --- a/tests/unit/resizable/all.html +++ b/tests/unit/resizable/all.html @@ -4,7 +4,7 @@ <meta charset="utf-8"> <title>jQuery UI Resizable Test Suite</title> - <script src="../../../jquery-1.7.2.js"></script> + <script src="../../../jquery-1.8.0.js"></script> <link rel="stylesheet" href="../../../external/qunit.css"> <link rel="stylesheet" href="../qunit-composite.css"> diff --git a/tests/unit/selectable/all.html b/tests/unit/selectable/all.html index 51778e771..e6cef3117 100644 --- a/tests/unit/selectable/all.html +++ b/tests/unit/selectable/all.html @@ -4,7 +4,7 @@ <meta charset="utf-8"> <title>jQuery UI Selectable Test Suite</title> - <script src="../../../jquery-1.7.2.js"></script> + <script src="../../../jquery-1.8.0.js"></script> <link rel="stylesheet" href="../../../external/qunit.css"> <link rel="stylesheet" href="../qunit-composite.css"> diff --git a/tests/unit/slider/all.html b/tests/unit/slider/all.html index bfadc0380..34f0e22f0 100644 --- a/tests/unit/slider/all.html +++ b/tests/unit/slider/all.html @@ -4,7 +4,7 @@ <meta charset="utf-8"> <title>jQuery UI Slider Test Suite</title> - <script src="../../../jquery-1.7.2.js"></script> + <script src="../../../jquery-1.8.0.js"></script> <link rel="stylesheet" href="../../../external/qunit.css"> <link rel="stylesheet" href="../qunit-composite.css"> diff --git a/tests/unit/sortable/all.html b/tests/unit/sortable/all.html index f9d63d62e..ee7841a43 100644 --- a/tests/unit/sortable/all.html +++ b/tests/unit/sortable/all.html @@ -4,7 +4,7 @@ <meta charset="utf-8"> <title>jQuery UI Sortable Test Suite</title> - <script src="../../../jquery-1.7.2.js"></script> + <script src="../../../jquery-1.8.0.js"></script> <link rel="stylesheet" href="../../../external/qunit.css"> <link rel="stylesheet" href="../qunit-composite.css"> diff --git a/tests/unit/spinner/all.html b/tests/unit/spinner/all.html index 72a2dd77a..4c91b08d6 100644 --- a/tests/unit/spinner/all.html +++ b/tests/unit/spinner/all.html @@ -4,7 +4,7 @@ <meta charset="utf-8"> <title>jQuery UI Spinner Test Suite</title> - <script src="../../../jquery-1.7.2.js"></script> + <script src="../../../jquery-1.8.0.js"></script> <link rel="stylesheet" href="../../../external/qunit.css"> <link rel="stylesheet" href="../qunit-composite.css"> diff --git a/tests/unit/spinner/spinner_methods.js b/tests/unit/spinner/spinner_methods.js index bafd949a7..af872f257 100644 --- a/tests/unit/spinner/spinner_methods.js +++ b/tests/unit/spinner/spinner_methods.js @@ -163,4 +163,12 @@ test( "value", function() { equal( element.spinner( "value" ), 9, "get value via value method" ); }); +test( "widget", function() { + expect( 2 ); + var element = $( "#spin" ).spinner(), + widgetElement = element.spinner( "widget" ); + equal( widgetElement.length, 1, "one element" ); + strictEqual( widgetElement[ 0 ], element.parent()[ 0 ], "parent element" ); +}); + })( jQuery ); diff --git a/tests/unit/subsuite.js b/tests/unit/subsuite.js index 6f966590b..67781f1dc 100644 --- a/tests/unit/subsuite.js +++ b/tests/unit/subsuite.js @@ -1,6 +1,11 @@ (function() { -var versions = [ "1.6", "1.6.1", "1.6.2", "1.6.3", "1.6.4", "1.7", "1.7.1", "1.7.2", "git" ], +var versions = [ + "1.6", "1.6.1", "1.6.2", "1.6.3", "1.6.4", + "1.7", "1.7.1", "1.7.2", + "1.8.0", + "git" + ], additionalTests = { accordion: [ "accordion_deprecated.html" ], position: [ "position_deprecated.html" ], diff --git a/tests/unit/tabs/all.html b/tests/unit/tabs/all.html index 41bf965f2..e5299c4eb 100644 --- a/tests/unit/tabs/all.html +++ b/tests/unit/tabs/all.html @@ -4,7 +4,7 @@ <meta charset="utf-8"> <title>jQuery UI Tabs Test Suite</title> - <script src="../../../jquery-1.7.2.js"></script> + <script src="../../../jquery-1.8.0.js"></script> <link rel="stylesheet" href="../../../external/qunit.css"> <link rel="stylesheet" href="../qunit-composite.css"> diff --git a/tests/unit/tabs/tabs_deprecated.js b/tests/unit/tabs/tabs_deprecated.js index 351433348..4a938c078 100644 --- a/tests/unit/tabs/tabs_deprecated.js +++ b/tests/unit/tabs/tabs_deprecated.js @@ -25,10 +25,11 @@ test( "panel ids", function() { module( "tabs (deprecated): options" ); asyncTest( "ajaxOptions", function() { - expect( 1 ); + expect( 2 ); var element = $( "#tabs2" ).tabs({ ajaxOptions: { + data: "foo=bar", converters: { "text html": function() { return "test"; @@ -36,6 +37,9 @@ asyncTest( "ajaxOptions", function() { } } }); + element.one( "tabsbeforeload", function( event, ui ) { + equal( ui.ajaxSettings.url.replace( /^[^\?]+/, "" ), "?foo=bar", "ajaxOptions.data" ); + }); element.one( "tabsload", function( event, ui ) { equal( $( ui.panel ).html(), "test" ); start(); diff --git a/tests/unit/tabs/tabs_methods.js b/tests/unit/tabs/tabs_methods.js index a41d7069d..fa6535158 100644 --- a/tests/unit/tabs/tabs_methods.js +++ b/tests/unit/tabs/tabs_methods.js @@ -28,7 +28,7 @@ test( "enable", function() { }); test( "enable( index )", function() { - expect( 10 ); + expect( 10 ); var element = $( "#tabs1" ).tabs({ disabled: true }); disabled( element, true ); @@ -62,7 +62,7 @@ test( "disable", function() { }); test( "disable( index )", function() { - expect( 10 ); + expect( 10 ); var element = $( "#tabs1" ).tabs({ disabled: false }); disabled( element, false ); @@ -264,4 +264,12 @@ asyncTest( "load", function() { } }); +test( "widget", function() { + expect( 2 ); + var element = $( "#tabs1" ).tabs(), + widgetElement = element.tabs( "widget" ); + equal( widgetElement.length, 1, "one element" ); + strictEqual( widgetElement[ 0 ], element[ 0 ], "same element" ); +}); + }( jQuery ) ); diff --git a/tests/unit/testsuite.js b/tests/unit/testsuite.js index 26f46138a..06890d8d9 100644 --- a/tests/unit/testsuite.js +++ b/tests/unit/testsuite.js @@ -1,5 +1,7 @@ (function( $ ) { +var reset, jshintLoaded; + window.TestHelpers = {}; function includeStyle( url ) { @@ -10,6 +12,15 @@ function includeScript( url ) { document.write( "<script src='../../../" + url + "'></script>" ); } +reset = QUnit.reset; +QUnit.reset = function() { + // Ensure jQuery events and data on the fixture are properly removed + jQuery("#qunit-fixture").empty(); + // Let QUnit reset the fixture + reset.apply( this, arguments ); +}; + + QUnit.config.requireExpects = true; QUnit.config.urlConfig.push({ @@ -20,7 +31,6 @@ QUnit.config.urlConfig.push({ TestHelpers.loadResources = QUnit.urlParams.min ? function() { - // TODO: proper include with theme images includeStyle( "dist/jquery-ui.min.css" ); includeScript( "dist/jquery-ui.min.js" ); } : @@ -39,7 +49,7 @@ QUnit.config.urlConfig.push({ tooltip: "Skip running JSHint, e.g. within TestSwarm, where Jenkins runs it already" }); -var jshintLoaded = false; +jshintLoaded = false; TestHelpers.testJshint = function( module ) { if ( QUnit.urlParams.nojshint ) { return; diff --git a/tests/unit/tooltip/all.html b/tests/unit/tooltip/all.html index c1aa35acf..367eb4584 100644 --- a/tests/unit/tooltip/all.html +++ b/tests/unit/tooltip/all.html @@ -4,7 +4,7 @@ <meta charset="utf-8"> <title>jQuery UI Tooltip Test Suite</title> - <script src="../../../jquery-1.7.2.js"></script> + <script src="../../../jquery-1.8.0.js"></script> <link rel="stylesheet" href="../../../external/qunit.css"> <link rel="stylesheet" href="../qunit-composite.css"> diff --git a/tests/unit/tooltip/tooltip_methods.js b/tests/unit/tooltip/tooltip_methods.js index ef783cbd3..0af1e06e9 100644 --- a/tests/unit/tooltip/tooltip_methods.js +++ b/tests/unit/tooltip/tooltip_methods.js @@ -59,14 +59,12 @@ test( "enable/disable", function() { $.fx.off = false; }); -/* -TODO currently tooltip doesn't override widget -can't return anything useful if no element is kept around and there's no useful reference -test("widget", function() { - var tooltip = $("#tooltipped1").tooltip(); - deepEqual(tooltip.tooltip("widget")[0], $(".ui-tooltip")[0]); - deepEqual(tooltip.tooltip("widget").end()[0], tooltip[0]); +test( "widget", function() { + expect( 2 ); + var element = $( "#tooltipped1" ).tooltip(), + widgetElement = element.tooltip( "widget" ); + equal( widgetElement.length, 1, "one element" ); + strictEqual( widgetElement[ 0 ], element[ 0 ], "same element" ); }); -*/ }( jQuery ) ); diff --git a/tests/unit/widget/all.html b/tests/unit/widget/all.html index e5b16c8d7..77fd80de1 100644 --- a/tests/unit/widget/all.html +++ b/tests/unit/widget/all.html @@ -4,7 +4,7 @@ <meta charset="utf-8"> <title>jQuery UI Widget Test Suite</title> - <script src="../../../jquery-1.7.2.js"></script> + <script src="../../../jquery-1.8.0.js"></script> <link rel="stylesheet" href="../../../external/qunit.css"> <link rel="stylesheet" href="../qunit-composite.css"> |