aboutsummaryrefslogtreecommitdiffstats
path: root/tests/unit
diff options
context:
space:
mode:
Diffstat (limited to 'tests/unit')
-rw-r--r--tests/unit/accordion/accordion.html17
-rw-r--r--tests/unit/accordion/accordion_deprecated.html17
-rw-r--r--tests/unit/accordion/all.html2
-rw-r--r--tests/unit/all.html2
-rw-r--r--tests/unit/autocomplete/all.html2
-rw-r--r--tests/unit/autocomplete/autocomplete.html22
-rw-r--r--tests/unit/autocomplete/autocomplete_events.js169
-rw-r--r--tests/unit/autocomplete/autocomplete_options.js2
-rw-r--r--tests/unit/button/all.html2
-rw-r--r--tests/unit/button/button.html17
-rw-r--r--tests/unit/core/all.html2
-rw-r--r--tests/unit/core/core.html11
-rw-r--r--tests/unit/core/selector.js8
-rw-r--r--tests/unit/datepicker/all.html2
-rw-r--r--tests/unit/datepicker/datepicker.html22
-rw-r--r--tests/unit/dialog/all.html2
-rw-r--r--tests/unit/dialog/dialog.html25
-rw-r--r--tests/unit/dialog/dialog_tickets.js31
-rw-r--r--tests/unit/draggable/all.html2
-rw-r--r--tests/unit/draggable/draggable.html16
-rw-r--r--tests/unit/droppable/all.html2
-rw-r--r--tests/unit/droppable/droppable.html18
-rw-r--r--tests/unit/effects/all.html2
-rw-r--r--tests/unit/effects/effects.html45
-rw-r--r--tests/unit/effects/effects_core.js140
-rw-r--r--tests/unit/effects/effects_scale.js11
-rw-r--r--tests/unit/menu/all.html2
-rw-r--r--tests/unit/menu/menu.html54
-rw-r--r--tests/unit/menu/menu_defaults.js2
-rw-r--r--tests/unit/menu/menu_events.js82
-rw-r--r--tests/unit/menu/menu_test_helpers.js6
-rw-r--r--tests/unit/position/all.html2
-rw-r--r--tests/unit/position/position.html61
-rw-r--r--tests/unit/position/position_core.js72
-rw-r--r--tests/unit/position/position_core_within.js153
-rw-r--r--tests/unit/position/position_deprecated.html11
-rw-r--r--tests/unit/progressbar/all.html2
-rw-r--r--tests/unit/progressbar/progressbar.html17
-rw-r--r--tests/unit/resizable/all.html2
-rw-r--r--tests/unit/resizable/resizable.html19
-rw-r--r--tests/unit/selectable/all.html2
-rw-r--r--tests/unit/selectable/selectable.html16
-rw-r--r--tests/unit/slider/all.html2
-rw-r--r--tests/unit/slider/slider.html18
-rw-r--r--tests/unit/sortable/all.html2
-rw-r--r--tests/unit/sortable/sortable.html16
-rw-r--r--tests/unit/spinner/all.html2
-rw-r--r--tests/unit/spinner/spinner.html19
-rw-r--r--tests/unit/spinner/spinner_core.js78
-rw-r--r--tests/unit/spinner/spinner_defaults.js6
-rw-r--r--tests/unit/spinner/spinner_events.js6
-rw-r--r--tests/unit/spinner/spinner_methods.js40
-rw-r--r--tests/unit/spinner/spinner_options.js196
-rw-r--r--tests/unit/subsuite.js2
-rw-r--r--tests/unit/tabs/all.html2
-rw-r--r--tests/unit/tabs/tabs.html16
-rw-r--r--tests/unit/tabs/tabs_core.js2
-rw-r--r--tests/unit/tabs/tabs_deprecated.html16
-rw-r--r--tests/unit/tabs/tabs_events.js3
-rw-r--r--tests/unit/tabs/tabs_methods.js4
-rw-r--r--tests/unit/tooltip/all.html2
-rw-r--r--tests/unit/tooltip/tooltip.html18
-rw-r--r--tests/unit/tooltip/tooltip_defaults.js2
-rw-r--r--tests/unit/tooltip/tooltip_events.js8
-rw-r--r--tests/unit/widget/all.html2
-rw-r--r--tests/unit/widget/widget.html11
-rw-r--r--tests/unit/widget/widget_core.js90
-rw-r--r--tests/unit/widget/widget_extend.js5
68 files changed, 1053 insertions, 609 deletions
diff --git a/tests/unit/accordion/accordion.html b/tests/unit/accordion/accordion.html
index b3c3b59ac..ed9b1aa1d 100644
--- a/tests/unit/accordion/accordion.html
+++ b/tests/unit/accordion/accordion.html
@@ -4,16 +4,21 @@
<meta charset="utf-8">
<title>jQuery UI Accordion Test Suite</title>
- <link rel="stylesheet" href="../../../themes/base/jquery.ui.core.css">
- <link rel="stylesheet" href="../../../themes/base/jquery.ui.accordion.css">
-
<script src="../../jquery.js"></script>
<script>
$.uiBackCompat = false;
</script>
- <script src="../../../ui/jquery.ui.core.js"></script>
- <script src="../../../ui/jquery.ui.widget.js"></script>
- <script src="../../../ui/jquery.ui.accordion.js"></script>
+ <script src="../../resource_loader.js"></script>
+ <script>
+ loadResources({
+ css: [ "ui.core", "ui.accordion" ],
+ js: [
+ "ui/jquery.ui.core.js",
+ "ui/jquery.ui.widget.js",
+ "ui/jquery.ui.accordion.js"
+ ]
+ });
+ </script>
<link rel="stylesheet" href="../../../external/qunit.css">
<script src="../../../external/qunit.js"></script>
diff --git a/tests/unit/accordion/accordion_deprecated.html b/tests/unit/accordion/accordion_deprecated.html
index 3a7ad86f2..f730d8029 100644
--- a/tests/unit/accordion/accordion_deprecated.html
+++ b/tests/unit/accordion/accordion_deprecated.html
@@ -4,13 +4,18 @@
<meta charset="utf-8">
<title>jQuery UI Accordion Test Suite</title>
- <link rel="stylesheet" href="../../../themes/base/jquery.ui.core.css">
- <link rel="stylesheet" href="../../../themes/base/jquery.ui.accordion.css">
-
<script src="../../jquery.js"></script>
- <script src="../../../ui/jquery.ui.core.js"></script>
- <script src="../../../ui/jquery.ui.widget.js"></script>
- <script src="../../../ui/jquery.ui.accordion.js"></script>
+ <script src="../../resource_loader.js"></script>
+ <script>
+ loadResources({
+ css: [ "ui.core", "ui.accordion" ],
+ js: [
+ "ui/jquery.ui.core.js",
+ "ui/jquery.ui.widget.js",
+ "ui/jquery.ui.accordion.js"
+ ]
+ });
+ </script>
<link rel="stylesheet" href="../../../external/qunit.css">
<script src="../../../external/qunit.js"></script>
diff --git a/tests/unit/accordion/all.html b/tests/unit/accordion/all.html
index ad4e44300..6c5d7787d 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.6.2.js"></script>
+ <script src="../../../jquery-1.7.js"></script>
<link rel="stylesheet" href="../../../external/qunit.css">
<link rel="stylesheet" href="../subsuiteRunner.css">
diff --git a/tests/unit/all.html b/tests/unit/all.html
index 41d379534..87677ed6c 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.6.2.js"></script>
+ <script src="../../jquery-1.7.js"></script>
<link rel="stylesheet" href="../../external/qunit.css">
<link rel="stylesheet" href="subsuiteRunner.css">
diff --git a/tests/unit/autocomplete/all.html b/tests/unit/autocomplete/all.html
index 6e410dbb3..a136d8c25 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.6.2.js"></script>
+ <script src="../../../jquery-1.7.js"></script>
<link rel="stylesheet" href="../../../external/qunit.css">
<link rel="stylesheet" href="../subsuiteRunner.css">
diff --git a/tests/unit/autocomplete/autocomplete.html b/tests/unit/autocomplete/autocomplete.html
index 8dc86c621..70d2ecfd1 100644
--- a/tests/unit/autocomplete/autocomplete.html
+++ b/tests/unit/autocomplete/autocomplete.html
@@ -4,15 +4,20 @@
<meta charset="utf-8">
<title>jQuery UI Autocomplete Test Suite</title>
- <link rel="stylesheet" href="../../../themes/base/jquery.ui.core.css">
- <link rel="stylesheet" href="../../../themes/base/jquery.ui.autocomplete.css">
-
<script src="../../jquery.js"></script>
- <script src="../../../ui/jquery.ui.core.js"></script>
- <script src="../../../ui/jquery.ui.widget.js"></script>
- <script src="../../../ui/jquery.ui.position.js"></script>
- <script src="../../../ui/jquery.ui.menu.js"></script>
- <script src="../../../ui/jquery.ui.autocomplete.js"></script>
+ <script src="../../resource_loader.js"></script>
+ <script>
+ loadResources({
+ css: [ "ui.core", "ui.menu", "ui.autocomplete" ],
+ js: [
+ "ui/jquery.ui.core.js",
+ "ui/jquery.ui.widget.js",
+ "ui/jquery.ui.position.js",
+ "ui/jquery.ui.menu.js",
+ "ui/jquery.ui.autocomplete.js"
+ ]
+ });
+ </script>
<link rel="stylesheet" href="../../../external/qunit.css">
<script src="../../../external/qunit.js"></script>
@@ -39,6 +44,7 @@
<div id="ac-wrap1" class="ac-wrap"></div>
<div id="ac-wrap2" class="ac-wrap"><input id="autocomplete" class="foo"></div>
<div id="autocomplete-contenteditable" contenteditable="" tabindex=0></div>
+<textarea id="autocomplete-textarea"></textarea>
</div>
</body>
diff --git a/tests/unit/autocomplete/autocomplete_events.js b/tests/unit/autocomplete/autocomplete_events.js
index c6d42ddcc..286d902f1 100644
--- a/tests/unit/autocomplete/autocomplete_events.js
+++ b/tests/unit/autocomplete/autocomplete_events.js
@@ -4,110 +4,73 @@ module( "autocomplete: events" );
var data = [ "Clojure", "COBOL", "ColdFusion", "Java", "JavaScript", "Scala", "Scheme" ];
-asyncTest( "all events", function() {
- expect( 13 );
- var element = $( "#autocomplete" )
- .autocomplete({
- autoFocus: false,
- delay: 0,
- source: data,
- search: function( event ) {
- equal( event.originalEvent.type, "keydown", "search originalEvent" );
- },
- response: function( event, ui ) {
- deepEqual( ui.content, [
- { label: "Clojure", value: "Clojure" },
- { label: "Java", value: "Java" },
- { label: "JavaScript", value: "JavaScript" }
- ], "response ui.content" );
- ui.content.splice( 0, 1 );
- },
- open: function( event ) {
- ok( menu.is( ":visible" ), "menu open on open" );
- },
- focus: function( event, ui ) {
- equal( event.originalEvent.type, "menufocus", "focus originalEvent" );
- deepEqual( ui.item, { label: "Java", value: "Java" }, "focus ui.item" );
- },
- close: function( event ) {
- equal( event.originalEvent.type, "menuselect", "close originalEvent" );
- ok( menu.is( ":hidden" ), "menu closed on close" );
- },
- select: function( event, ui ) {
- equal( event.originalEvent.type, "menuselect", "select originalEvent" );
- deepEqual( ui.item, { label: "Java", value: "Java" }, "select ui.item" );
- },
- change: function( event, ui ) {
- equal( event.originalEvent.type, "blur", "change originalEvent" );
- deepEqual( ui.item, { label: "Java", value: "Java" }, "chnage ui.item" );
- ok( menu.is( ":hidden" ), "menu closed on change" );
- start();
- }
- }),
- menu = element.autocomplete( "widget" );
-
- element.focus().val( "j" ).keydown();
- setTimeout(function() {
- ok( menu.is( ":visible" ), "menu is visible after delay" );
- element.simulate( "keydown", { keyCode: $.ui.keyCode.DOWN } );
- element.simulate( "keydown", { keyCode: $.ui.keyCode.ENTER } );
- // blurring through jQuery causes a bug in IE 6 which causes the
- // autocompletechange event to occur twice
- element[0].blur();
- }, 50 );
-});
-
-asyncTest( "all events - contenteditable", function() {
- expect( 13 );
- var element = $( "#autocomplete-contenteditable" )
- .autocomplete({
- autoFocus: false,
- delay: 0,
- source: data,
- search: function( event ) {
- equal( event.originalEvent.type, "keydown", "search originalEvent" );
- },
- response: function( event, ui ) {
- deepEqual( ui.content, [
- { label: "Clojure", value: "Clojure" },
- { label: "Java", value: "Java" },
- { label: "JavaScript", value: "JavaScript" }
- ], "response ui.content" );
- ui.content.splice( 0, 1 );
- },
- open: function( event ) {
- ok( menu.is( ":visible" ), "menu open on open" );
- },
- focus: function( event, ui ) {
- equal( event.originalEvent.type, "menufocus", "focus originalEvent" );
- deepEqual( ui.item, { label: "Java", value: "Java" }, "focus ui.item" );
- },
- close: function( event ) {
- equal( event.originalEvent.type, "menuselect", "close originalEvent" );
- ok( menu.is( ":hidden" ), "menu closed on close" );
- },
- select: function( event, ui ) {
- equal( event.originalEvent.type, "menuselect", "select originalEvent" );
- deepEqual( ui.item, { label: "Java", value: "Java" }, "select ui.item" );
- },
- change: function( event, ui ) {
- equal( event.originalEvent.type, "blur", "change originalEvent" );
- deepEqual( ui.item, { label: "Java", value: "Java" }, "chnage ui.item" );
- ok( menu.is( ":hidden" ), "menu closed on change" );
- start();
- }
- }),
- menu = element.autocomplete( "widget" );
+$.each([
+ {
+ type: "input",
+ selector: "#autocomplete",
+ valueMethod: "val"
+ },
+ {
+ type: "textarea",
+ selector: "#autocomplete-textarea",
+ valueMethod: "val"
+ },
+ {
+ type: "contenteditable",
+ selector: "#autocomplete-contenteditable",
+ valueMethod: "text"
+ }
+], function( i, settings ) {
+ asyncTest( "all events - " + settings.type, function() {
+ expect( 13 );
+ var element = $( settings.selector )
+ .autocomplete({
+ autoFocus: false,
+ delay: 0,
+ source: data,
+ search: function( event ) {
+ equal( event.originalEvent.type, "keydown", "search originalEvent" );
+ },
+ response: function( event, ui ) {
+ deepEqual( ui.content, [
+ { label: "Clojure", value: "Clojure" },
+ { label: "Java", value: "Java" },
+ { label: "JavaScript", value: "JavaScript" }
+ ], "response ui.content" );
+ ui.content.splice( 0, 1 );
+ },
+ open: function( event ) {
+ ok( menu.is( ":visible" ), "menu open on open" );
+ },
+ focus: function( event, ui ) {
+ equal( event.originalEvent.type, "menufocus", "focus originalEvent" );
+ deepEqual( ui.item, { label: "Java", value: "Java" }, "focus ui.item" );
+ },
+ close: function( event ) {
+ equal( event.originalEvent.type, "menuselect", "close originalEvent" );
+ ok( menu.is( ":hidden" ), "menu closed on close" );
+ },
+ select: function( event, ui ) {
+ equal( event.originalEvent.type, "menuselect", "select originalEvent" );
+ deepEqual( ui.item, { label: "Java", value: "Java" }, "select ui.item" );
+ },
+ change: function( event, ui ) {
+ equal( event.originalEvent.type, "blur", "change originalEvent" );
+ deepEqual( ui.item, { label: "Java", value: "Java" }, "change ui.item" );
+ ok( menu.is( ":hidden" ), "menu closed on change" );
+ start();
+ }
+ }),
+ menu = element.autocomplete( "widget" );
- element.focus().text( "j" ).keydown();
- setTimeout(function() {
- ok( menu.is( ":visible" ), "menu is visible after delay" );
- element.simulate( "keydown", { keyCode: $.ui.keyCode.DOWN } );
- element.simulate( "keydown", { keyCode: $.ui.keyCode.ENTER } );
- // TODO: blurring through jQuery causes a bug in IE 6 which causes the
- // autocompletechange event to occur twice
- element[0].blur();
- }, 50 );
+ element.simulate( "focus" )[ settings.valueMethod ]( "j" ).keydown();
+ setTimeout(function() {
+ ok( menu.is( ":visible" ), "menu is visible after delay" );
+ element.simulate( "keydown", { keyCode: $.ui.keyCode.DOWN } );
+ element.simulate( "keydown", { keyCode: $.ui.keyCode.ENTER } );
+ element.simulate( "blur" );
+ }, 50 );
+ });
});
asyncTest( "change without selection", function() {
diff --git a/tests/unit/autocomplete/autocomplete_options.js b/tests/unit/autocomplete/autocomplete_options.js
index 8d11aa399..114e9a42b 100644
--- a/tests/unit/autocomplete/autocomplete_options.js
+++ b/tests/unit/autocomplete/autocomplete_options.js
@@ -34,7 +34,7 @@ function autoFocusTest( afValue, focusedLength ) {
delay: 0,
source: data,
open: function( event, ui ) {
- equal( element.autocomplete( "widget" ).children( ".ui-menu-item:first .ui-state-focus" ).length,
+ equal( element.autocomplete( "widget" ).children( ".ui-menu-item:first" ).find( ".ui-state-focus" ).length,
focusedLength, "first item is " + (afValue ? "" : "not") + " auto focused" );
start();
}
diff --git a/tests/unit/button/all.html b/tests/unit/button/all.html
index 4ff579703..30222945d 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.6.2.js"></script>
+ <script src="../../../jquery-1.7.js"></script>
<link rel="stylesheet" href="../../../external/qunit.css">
<link rel="stylesheet" href="../subsuiteRunner.css">
diff --git a/tests/unit/button/button.html b/tests/unit/button/button.html
index 7fcf07eec..5ec7e316a 100644
--- a/tests/unit/button/button.html
+++ b/tests/unit/button/button.html
@@ -4,13 +4,18 @@
<meta charset="utf-8">
<title>jQuery UI Button Test Suite</title>
- <link rel="stylesheet" href="../../../themes/base/jquery.ui.core.css">
- <link rel="stylesheet" href="../../../themes/base/jquery.ui.button.css">
-
<script src="../../jquery.js"></script>
- <script src="../../../ui/jquery.ui.core.js"></script>
- <script src="../../../ui/jquery.ui.widget.js"></script>
- <script src="../../../ui/jquery.ui.button.js"></script>
+ <script src="../../resource_loader.js"></script>
+ <script>
+ loadResources({
+ css: [ "ui.core", "ui.button" ],
+ js: [
+ "ui/jquery.ui.core.js",
+ "ui/jquery.ui.widget.js",
+ "ui/jquery.ui.button.js"
+ ]
+ });
+ </script>
<link rel="stylesheet" href="../../../external/qunit.css">
<script src="../../../external/qunit.js"></script>
diff --git a/tests/unit/core/all.html b/tests/unit/core/all.html
index 0bc9fdb2a..2478a30af 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.6.2.js"></script>
+ <script src="../../../jquery-1.7.js"></script>
<link rel="stylesheet" href="../../../external/qunit.css">
<link rel="stylesheet" href="../subsuiteRunner.css">
diff --git a/tests/unit/core/core.html b/tests/unit/core/core.html
index fdde81766..3b1dc1fc8 100644
--- a/tests/unit/core/core.html
+++ b/tests/unit/core/core.html
@@ -5,8 +5,12 @@
<title>jQuery UI Core Test Suite</title>
<script src="../../jquery.js"></script>
- <script src="../../../ui/jquery.ui.core.js"></script>
- <script src="../../../ui/jquery.ui.widget.js"></script>
+ <script src="../../resource_loader.js"></script>
+ <script>
+ loadResources({
+ js: [ "ui/jquery.ui.core.js" ]
+ });
+ </script>
<link rel="stylesheet" href="../../../external/qunit.css">
<script src="../../../external/qunit.js"></script>
@@ -46,6 +50,9 @@
<area shape="rect" coords="1,1,2,2" href="foo.html" id="areaNoImg">
</map>
+<form id="formNoTabindex"></form>
+<form id="formTabindex" tabindex="1"></form>
+
<div>
<input id="visibleAncestor-inputTypeNone">
<input type="text" id="visibleAncestor-inputTypeText">
diff --git a/tests/unit/core/selector.js b/tests/unit/core/selector.js
index de5be3da1..2fb78025c 100644
--- a/tests/unit/core/selector.js
+++ b/tests/unit/core/selector.js
@@ -79,8 +79,10 @@ test("data", function() {
});
test("focusable - visible, enabled elements", function() {
- expect(16);
+ expect(18);
+ isNotFocusable('#formNoTabindex', 'form');
+ isFocusable('#formTabindex', 'form with tabindex');
isFocusable('#visibleAncestor-inputTypeNone', 'input, no type');
isFocusable('#visibleAncestor-inputTypeText', 'input, type text');
isFocusable('#visibleAncestor-inputTypeCheckbox', 'input, type checkbox');
@@ -156,8 +158,10 @@ test("focusable - area elements", function() {
});
test("tabbable - visible, enabled elements", function() {
- expect(16);
+ expect(18);
+ isNotTabbable('#formNoTabindex', 'form');
+ isTabbable('#formTabindex', 'form with tabindex');
isTabbable('#visibleAncestor-inputTypeNone', 'input, no type');
isTabbable('#visibleAncestor-inputTypeText', 'input, type text');
isTabbable('#visibleAncestor-inputTypeCheckbox', 'input, type checkbox');
diff --git a/tests/unit/datepicker/all.html b/tests/unit/datepicker/all.html
index 0891de88c..c6f985d58 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.6.2.js"></script>
+ <script src="../../../jquery-1.7.js"></script>
<link rel="stylesheet" href="../../../external/qunit.css">
<link rel="stylesheet" href="../subsuiteRunner.css">
diff --git a/tests/unit/datepicker/datepicker.html b/tests/unit/datepicker/datepicker.html
index 108023372..592db53cc 100644
--- a/tests/unit/datepicker/datepicker.html
+++ b/tests/unit/datepicker/datepicker.html
@@ -4,16 +4,20 @@
<meta charset="utf-8">
<title>jQuery UI Datepicker Test Suite</title>
- <link rel="stylesheet" href="../../../themes/base/jquery.ui.core.css">
- <link rel="stylesheet" href="../../../themes/base/jquery.ui.datepicker.css">
-
<script src="../../jquery.js"></script>
- <script src="../../../ui/jquery.ui.core.js"></script>
- <script src="../../../ui/jquery.ui.widget.js"></script>
- <script src="../../../ui/jquery.ui.datepicker.js"></script>
- <script src="../../../ui/i18n/jquery.ui.datepicker-fr.js"></script>
- <script src="../../../ui/i18n/jquery.ui.datepicker-he.js"></script>
- <script src="../../../ui/i18n/jquery.ui.datepicker-zh-CN.js"></script>
+ <script src="../../resource_loader.js"></script>
+ <script>
+ loadResources({
+ css: [ "ui.core", "ui.datepicker" ],
+ js: [
+ "ui/jquery.ui.core.js",
+ "ui/jquery.ui.datepicker.js",
+ "ui/i18n/jquery.ui.datepicker-fr.js",
+ "ui/i18n/jquery.ui.datepicker-he.js",
+ "ui/i18n/jquery.ui.datepicker-zh-CN.js"
+ ]
+ });
+ </script>
<link rel="stylesheet" href="../../../external/qunit.css">
<script src="../../../external/qunit.js"></script>
diff --git a/tests/unit/dialog/all.html b/tests/unit/dialog/all.html
index 8aed4c05e..e65863678 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.6.2.js"></script>
+ <script src="../../../jquery-1.7.js"></script>
<link rel="stylesheet" href="../../../external/qunit.css">
<link rel="stylesheet" href="../subsuiteRunner.css">
diff --git a/tests/unit/dialog/dialog.html b/tests/unit/dialog/dialog.html
index b35ae5823..94b20a225 100644
--- a/tests/unit/dialog/dialog.html
+++ b/tests/unit/dialog/dialog.html
@@ -4,18 +4,23 @@
<meta charset="utf-8">
<title>jQuery UI Dialog Test Suite</title>
- <link rel="stylesheet" href="../../../themes/base/jquery.ui.core.css">
- <link rel="stylesheet" href="../../../themes/base/jquery.ui.dialog.css">
-
<script src="../../jquery.js"></script>
<script src="../../../external/jquery.bgiframe-2.1.2.js"></script>
- <script src="../../../ui/jquery.ui.core.js"></script>
- <script src="../../../ui/jquery.ui.widget.js"></script>
- <script src="../../../ui/jquery.ui.mouse.js"></script>
- <script src="../../../ui/jquery.ui.draggable.js"></script>
- <script src="../../../ui/jquery.ui.position.js"></script>
- <script src="../../../ui/jquery.ui.resizable.js"></script>
- <script src="../../../ui/jquery.ui.dialog.js"></script>
+ <script src="../../resource_loader.js"></script>
+ <script>
+ loadResources({
+ css: [ "ui.core", "ui.dialog" ],
+ js: [
+ "ui/jquery.ui.core.js",
+ "ui/jquery.ui.widget.js",
+ "ui/jquery.ui.position.js",
+ "ui/jquery.ui.mouse.js",
+ "ui/jquery.ui.draggable.js",
+ "ui/jquery.ui.resizable.js",
+ "ui/jquery.ui.dialog.js"
+ ]
+ });
+ </script>
<link rel="stylesheet" href="../../../external/qunit.css">
<script src="../../../external/qunit.js"></script>
diff --git a/tests/unit/dialog/dialog_tickets.js b/tests/unit/dialog/dialog_tickets.js
index 1cfdcefea..b203ca7d5 100644
--- a/tests/unit/dialog/dialog_tickets.js
+++ b/tests/unit/dialog/dialog_tickets.js
@@ -3,7 +3,36 @@
*/
(function($) {
-module("dialog: tickets");
+module( "dialog: tickets" );
+
+asyncTest( "#3123: Prevent tabbing out of modal dialogs", function() {
+ expect( 3 );
+
+ var el = $( "<div><input id='t3123-first'><input id='t3123-last'></div>" ).dialog({ modal: true }),
+ inputs = el.find( "input" ),
+ widget = el.dialog( "widget" );
+
+ inputs.eq( 1 ).focus();
+ equal( document.activeElement, inputs[1], "Focus set on second input" );
+ inputs.eq( 1 ).simulate( "keydown", { keyCode: $.ui.keyCode.TAB });
+
+ setTimeout( checkTab, 2 );
+
+ function checkTab() {
+ ok( $.contains( widget, document.activeElement ), "Tab key event moved focus within the modal" );
+
+ // check shift tab
+ $( document.activeElement ).simulate( "keydown", { keyCode: $.ui.keyCode.TAB, shiftKey: true });
+ setTimeout( checkShiftTab, 2 );
+ }
+
+ function checkShiftTab() {
+ ok( $.contains( widget, document.activeElement ), "Shift-Tab key event moved focus within the modal" );
+
+ el.remove();
+ start();
+ }
+});
test("#4826: setting resizable false toggles resizable on dialog", function() {
expect(6);
diff --git a/tests/unit/draggable/all.html b/tests/unit/draggable/all.html
index 8f6279eb9..6a1bcc61b 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.6.2.js"></script>
+ <script src="../../../jquery-1.7.js"></script>
<link rel="stylesheet" href="../../../external/qunit.css">
<link rel="stylesheet" href="../subsuiteRunner.css">
diff --git a/tests/unit/draggable/draggable.html b/tests/unit/draggable/draggable.html
index e5006bf17..5be71f460 100644
--- a/tests/unit/draggable/draggable.html
+++ b/tests/unit/draggable/draggable.html
@@ -5,10 +5,18 @@
<title>jQuery UI Draggable Test Suite</title>
<script src="../../jquery.js"></script>
- <script src="../../../ui/jquery.ui.core.js"></script>
- <script src="../../../ui/jquery.ui.widget.js"></script>
- <script src="../../../ui/jquery.ui.mouse.js"></script>
- <script src="../../../ui/jquery.ui.draggable.js"></script>
+ <script src="../../resource_loader.js"></script>
+ <script>
+ loadResources({
+ css: [ "ui.core" ],
+ js: [
+ "ui/jquery.ui.core.js",
+ "ui/jquery.ui.widget.js",
+ "ui/jquery.ui.mouse.js",
+ "ui/jquery.ui.draggable.js"
+ ]
+ });
+ </script>
<link rel="stylesheet" href="../../../external/qunit.css">
<script src="../../../external/qunit.js"></script>
diff --git a/tests/unit/droppable/all.html b/tests/unit/droppable/all.html
index 5296b3cfe..adb4d0ce9 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.6.2.js"></script>
+ <script src="../../../jquery-1.7.js"></script>
<link rel="stylesheet" href="../../../external/qunit.css">
<link rel="stylesheet" href="../subsuiteRunner.css">
diff --git a/tests/unit/droppable/droppable.html b/tests/unit/droppable/droppable.html
index 149430bcf..abf94f0c7 100644
--- a/tests/unit/droppable/droppable.html
+++ b/tests/unit/droppable/droppable.html
@@ -5,11 +5,19 @@
<title>jQuery UI Droppable Test Suite</title>
<script src="../../jquery.js"></script>
- <script src="../../../ui/jquery.ui.core.js"></script>
- <script src="../../../ui/jquery.ui.widget.js"></script>
- <script src="../../../ui/jquery.ui.mouse.js"></script>
- <script src="../../../ui/jquery.ui.draggable.js"></script>
- <script src="../../../ui/jquery.ui.droppable.js"></script>
+ <script src="../../resource_loader.js"></script>
+ <script>
+ loadResources({
+ css: [ "ui.core" ],
+ js: [
+ "ui/jquery.ui.core.js",
+ "ui/jquery.ui.widget.js",
+ "ui/jquery.ui.mouse.js",
+ "ui/jquery.ui.draggable.js",
+ "ui/jquery.ui.droppable.js"
+ ]
+ });
+ </script>
<link rel="stylesheet" href="../../../external/qunit.css">
<script src="../../../external/qunit.js"></script>
diff --git a/tests/unit/effects/all.html b/tests/unit/effects/all.html
index 6a9617ba4..8c12d76fd 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.6.2.js"></script>
+ <script src="../../../jquery-1.7.js"></script>
<link rel="stylesheet" href="../../../external/qunit.css">
<link rel="stylesheet" href="../subsuiteRunner.css">
diff --git a/tests/unit/effects/effects.html b/tests/unit/effects/effects.html
index f2c447ef7..06023c55d 100644
--- a/tests/unit/effects/effects.html
+++ b/tests/unit/effects/effects.html
@@ -8,20 +8,27 @@
<script>
$.uiBackCompat = false;
</script>
- <script src="../../../ui/jquery.effects.core.js"></script>
- <script src="../../../ui/jquery.effects.blind.js"></script>
- <script src="../../../ui/jquery.effects.bounce.js"></script>
- <script src="../../../ui/jquery.effects.clip.js"></script>
- <script src="../../../ui/jquery.effects.drop.js"></script>
- <script src="../../../ui/jquery.effects.explode.js"></script>
- <script src="../../../ui/jquery.effects.fade.js"></script>
- <script src="../../../ui/jquery.effects.fold.js"></script>
- <script src="../../../ui/jquery.effects.highlight.js"></script>
- <script src="../../../ui/jquery.effects.pulsate.js"></script>
- <script src="../../../ui/jquery.effects.scale.js"></script>
- <script src="../../../ui/jquery.effects.shake.js"></script>
- <script src="../../../ui/jquery.effects.slide.js"></script>
- <script src="../../../ui/jquery.effects.transfer.js"></script>
+ <script src="../../resource_loader.js"></script>
+ <script>
+ loadResources({
+ js: [
+ "ui/jquery.effects.core.js",
+ "ui/jquery.effects.blind.js",
+ "ui/jquery.effects.bounce.js",
+ "ui/jquery.effects.clip.js",
+ "ui/jquery.effects.drop.js",
+ "ui/jquery.effects.explode.js",
+ "ui/jquery.effects.fade.js",
+ "ui/jquery.effects.fold.js",
+ "ui/jquery.effects.highlight.js",
+ "ui/jquery.effects.pulsate.js",
+ "ui/jquery.effects.scale.js",
+ "ui/jquery.effects.shake.js",
+ "ui/jquery.effects.slide.js",
+ "ui/jquery.effects.transfer.js"
+ ]
+ });
+ </script>
<link rel="stylesheet" href="../../../external/qunit.css">
<script src="../../../external/qunit.js"></script>
@@ -75,6 +82,14 @@
height: 50px;
}
+ .ticket7106 {
+ width: 50px;
+ height: 50px;
+ }
+ .ticket7106.animate {
+ width: 100px;
+ }
+
</style>
</head>
<body>
@@ -94,6 +109,8 @@
</div>
<div class="testScale">
</div>
+<div class="ticket7106">
+</div>
</div>
</body>
diff --git a/tests/unit/effects/effects_core.js b/tests/unit/effects/effects_core.js
index 2b4d684eb..aca4c4694 100644
--- a/tests/unit/effects/effects_core.js
+++ b/tests/unit/effects/effects_core.js
@@ -31,59 +31,19 @@ test( "Immediate Return Conditions", function() {
equal( ++count, 3, "Both Functions worked properly" );
});
-$.each( $.effects.effect, function( effect ) {
- if ( effect === "transfer" ) {
- return;
- }
- module( "effect."+effect );
- asyncTest( "show/hide", function() {
- var hidden = $( "div.hidden" );
- expect( 8 );
-
- var count = 0,
- test = 0;
-
- function queueTest( fn ) {
- count++;
- var point = count;
- return function( next ) {
- test++;
- equal( point, test, "Queue function fired in order" );
- if ( fn ) {
- fn();
- } else {
- setTimeout( next, minDuration );
- }
- };
- }
-
- hidden.queue( queueTest() ).show( effect, minDuration, queueTest(function() {
- equal( hidden.css("display"), "block", "Hidden is shown after .show(\"" +effect+ "\", time)" );
- })).queue( queueTest() ).hide( effect, minDuration, queueTest(function() {
- equal( hidden.css("display"), "none", "Back to hidden after .hide(\"" +effect+ "\", time)" );
- })).queue( queueTest(function(next) {
- deepEqual( hidden.queue(), ["inprogress"], "Only the inprogress sentinel remains");
- start();
- }));
- });
-
- asyncTest( "relative width & height - properties are preserved", function() {
- var test = $("div.relWidth.relHeight"),
- width = test.width(), height = test.height(),
- cssWidth = test[0].style.width, cssHeight = test[0].style.height;
+test( "createWrapper and removeWrapper retain focused elements (#7595)", function() {
+ expect( 2 );
+ var test = $( "div.hidden" ).show(),
+ input = $( "<input type='text'>" ).appendTo( test ).focus();
- expect( 4 );
- test.toggle( effect, minDuration, function() {
- equal( test[0].style.width, cssWidth, "Inline CSS Width has been reset after animation ended" );
- equal( test[0].style.height, cssHeight, "Inline CSS Height has been rest after animation ended" );
- start();
- });
- equal( test.width(), width, "Width is the same px after animation started" );
- equal( test.height(), height, "Height is the same px after animation started" );
- });
+ $.effects.createWrapper( test );
+ equal( document.activeElement, input[ 0 ], "Active element is still input after createWrapper" );
+ $.effects.removeWrapper( test );
+ equal( document.activeElement, input[ 0 ], "Active element is still input after removeWrapper" );
});
-module("animateClass");
+
+module( "effects.core: animateClass" );
asyncTest( "animateClass works with borderStyle", function() {
var test = $("div.animateClass"),
@@ -143,22 +103,80 @@ asyncTest( "animateClass clears style properties when stopped", function() {
expect( 2 );
test.addClass( "testChangeBackground", duration );
- notEqual( orig, style.cssText, "cssText is the not the same after starting animation" );
+ notEqual( orig, style.cssText, "cssText is not the same after starting animation" );
test.stop( true, true );
- equal( orig, style.cssText, "cssText is the same after stopping animation midway" );
+ equal( orig, $.trim( style.cssText ), "cssText is the same after stopping animation midway" );
start();
});
-test( "createWrapper and removeWrapper retain focused elements (#7595)", function() {
- expect( 2 );
- var test = $( "div.hidden" ).show(),
- input = $( "<input>" ).appendTo( test ).focus();
+asyncTest( "animateClass: css and class changes during animation are not lost (#7106)", function() {
+ var test = $( "div.ticket7106" );
- $.effects.createWrapper( test );
- equal( document.activeElement, input[ 0 ], "Active element is still input after createWrapper" );
- $.effects.removeWrapper( test );
- equal( document.activeElement, input[ 0 ], "Active element is still input after removeWrapper" );
-})
+ // add a class and change a style property after starting an animated class
+ test.addClass( "animate", minDuration, animationComplete )
+ .addClass( "testClass" )
+ .height( 100 );
+
+ // ensure the class stays and that the css property stays
+ function animationComplete() {
+ ok( test.hasClass( "testClass" ), "class change during animateClass was not lost" );
+ equal( test.height(), 100, "css change during animateClass was not lost" );
+ start();
+ }
+});
+
+
+$.each( $.effects.effect, function( effect ) {
+ if ( effect === "transfer" ) {
+ return;
+ }
+ module( "effect."+effect );
+ asyncTest( "show/hide", function() {
+ var hidden = $( "div.hidden" );
+ expect( 8 );
+
+ var count = 0,
+ test = 0;
+
+ function queueTest( fn ) {
+ count++;
+ var point = count;
+ return function( next ) {
+ test++;
+ equal( point, test, "Queue function fired in order" );
+ if ( fn ) {
+ fn();
+ } else {
+ setTimeout( next, minDuration );
+ }
+ };
+ }
+
+ hidden.queue( queueTest() ).show( effect, minDuration, queueTest(function() {
+ equal( hidden.css("display"), "block", "Hidden is shown after .show(\"" +effect+ "\", time)" );
+ })).queue( queueTest() ).hide( effect, minDuration, queueTest(function() {
+ equal( hidden.css("display"), "none", "Back to hidden after .hide(\"" +effect+ "\", time)" );
+ })).queue( queueTest(function(next) {
+ deepEqual( hidden.queue(), ["inprogress"], "Only the inprogress sentinel remains");
+ start();
+ }));
+ });
+
+ asyncTest( "relative width & height - properties are preserved", function() {
+ var test = $("div.relWidth.relHeight"),
+ width = test.width(), height = test.height(),
+ cssWidth = test[0].style.width, cssHeight = test[0].style.height;
+
+ expect( 4 );
+ test.toggle( effect, minDuration, function() {
+ equal( test[0].style.width, cssWidth, "Inline CSS Width has been reset after animation ended" );
+ equal( test[0].style.height, cssHeight, "Inline CSS Height has been rest after animation ended" );
+ start();
+ });
+ equal( test.width(), width, "Width is the same px after animation started" );
+ equal( test.height(), height, "Height is the same px after animation started" );
+ });
+});
})(jQuery);
diff --git a/tests/unit/effects/effects_scale.js b/tests/unit/effects/effects_scale.js
index 1436cd030..b9bb91c2e 100644
--- a/tests/unit/effects/effects_scale.js
+++ b/tests/unit/effects/effects_scale.js
@@ -44,16 +44,23 @@ function suite( position ) {
run( position, "top", "left", "top", "left" );
run( position, "top", "left", "middle", "center" );
run( position, "top", "left", "bottom", "right" );
+ /* Firefox is currently not capable of supporting detection of bottom and right....
run( position, "bottom", "right", "top", "left" );
run( position, "bottom", "right", "middle", "center" );
run( position, "bottom", "right", "bottom", "right" );
+ */
}
$(function() {
suite( "absolute" );
suite( "relative" );
- $.offset.initialize();
- if ( $.offset.supportsFixedPosition ) {
+ var fixed = $.support.fixedPosition;
+ // jQuery < 1.7 uses $.offset.supportsFixedPosition
+ if ( fixed === undefined ) {
+ $.offset.initialize();
+ fixed = $.offset.supportsFixedPosition;
+ }
+ if ( fixed ) {
suite( "fixed" );
}
});
diff --git a/tests/unit/menu/all.html b/tests/unit/menu/all.html
index 399614254..c5f546ae0 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.6.2.js"></script>
+ <script src="../../../jquery-1.7.js"></script>
<link rel="stylesheet" href="../../../external/qunit.css">
<link rel="stylesheet" href="../subsuiteRunner.css">
diff --git a/tests/unit/menu/menu.html b/tests/unit/menu/menu.html
index dc5b71a00..76f4a7a31 100644
--- a/tests/unit/menu/menu.html
+++ b/tests/unit/menu/menu.html
@@ -4,12 +4,18 @@
<meta charset="utf-8">
<title>jQuery UI Menu Test Suite</title>
- <link rel="stylesheet" href="../../../themes/base/jquery.ui.all.css">
-
<script src="../../jquery.js"></script>
- <script src="../../../ui/jquery.ui.core.js"></script>
- <script src="../../../ui/jquery.ui.widget.js"></script>
- <script src="../../../ui/jquery.ui.menu.js"></script>
+ <script src="../../resource_loader.js"></script>
+ <script>
+ loadResources({
+ css: [ "ui.core", "ui.menu" ],
+ js: [
+ "ui/jquery.ui.core.js",
+ "ui/jquery.ui.widget.js",
+ "ui/jquery.ui.menu.js"
+ ]
+ });
+ </script>
<link rel="stylesheet" href="../../../external/qunit.css">
<script src="../../../external/qunit.js"></script>
@@ -207,6 +213,44 @@
<li class="foo"><a class="foo" href="#">Amesville</a></li>
</ul>
+<div id="menu5">
+ <blockquote><a href="#">Aberdeen</a></blockquote>
+ <blockquote><a href="#">Ada</a></blockquote>
+ <blockquote><a href="#">Adamsville</a></blockquote>
+ <blockquote><a href="#">Addyston</a></blockquote>
+ <blockquote>
+ <a href="#">Delphi</a>
+ <div>
+ <blockquote><a href="#">Ada</a></blockquote>
+ <blockquote><a href="#">Saarland</a></blockquote>
+ <blockquote><a href="#">Salzburg</a></blockquote>
+ </div>
+ </blockquote>
+ <blockquote><a href="#">Saarland</a></blockquote>
+ <blockquote>
+ <a href="#">Salzburg</a>
+ <div>
+ <blockquote>
+ <a href="#">Delphi</a>
+ <div>
+ <blockquote><a href="#">Ada</a></blockquote>
+ <blockquote><a href="#">Saarland</a></blockquote>
+ <blockquote><a href="#">Salzburg</a></blockquote>
+ </div>
+ </blockquote>
+ <blockquote>
+ <a href="#">Delphi</a>
+ <div>
+ <blockquote><a href="#">Ada</a></blockquote>
+ <blockquote><a href="#">Saarland</a></blockquote>
+ <blockquote><a href="#">Salzburg</a></blockquote>
+ </div>
+ </blockquote>
+ <blockquote><a href="#">Perch</a></blockquote>
+ </div>
+ </blockquote>
+</div>
+
<div id="log"></div>
</div>
diff --git a/tests/unit/menu/menu_defaults.js b/tests/unit/menu/menu_defaults.js
index dd182ca09..a559a3d8d 100644
--- a/tests/unit/menu/menu_defaults.js
+++ b/tests/unit/menu/menu_defaults.js
@@ -5,6 +5,8 @@ commonWidgetTests( "menu", {
my: "left top",
at: "right top"
},
+ items: "ul",
+ trigger: null,
// callbacks
create: null
diff --git a/tests/unit/menu/menu_events.js b/tests/unit/menu/menu_events.js
index 9ea54faf0..55ec1e2ff 100644
--- a/tests/unit/menu/menu_events.js
+++ b/tests/unit/menu/menu_events.js
@@ -21,6 +21,23 @@ test("handle click on menu", function() {
equals( $("#log").html(), "1,3,2,afterclick,1,click,", "Click order not valid.");
});
+test("handle click on custom item menu", function() {
+ expect(1);
+ var ac = $('#menu5').menu({
+ select: function(event, ui) {
+ menu_log();
+ },
+ items: "div"
+ });
+ menu_log("click",true);
+ menu_click($('#menu5'),"1");
+ menu_log("afterclick");
+ menu_click( ac,"2");
+ menu_click($('#menu5'),"3");
+ menu_click( ac,"1");
+ equals( $("#log").html(), "1,3,2,afterclick,1,click,", "Click order not valid.");
+});
+
test( "handle blur: click", function() {
expect( 4 );
var $menu = $( "#menu1" ).menu({
@@ -41,6 +58,71 @@ test( "handle blur: click", function() {
$("#remove").remove();
});
+test( "handle blur on custom item menu: click", function() {
+ expect( 4 );
+ var $menu = $( "#menu5" ).menu({
+ focus: function( event, ui ) {
+ equal( event.originalEvent.type, "click", "focus triggered 'click'" );
+ equal( event.type, "menufocus", "focus event.type is 'menufocus'" );
+
+ },
+ blur: function( event, ui ) {
+ equal( event.originalEvent.type, "click", "blur triggered 'click'" );
+ equal( event.type, "menublur", "blur event.type is 'menublur'" );
+ },
+ items: "div"
+ });
+
+ menu_click($('#menu5'),"1");
+ $( "<a>", { id: "remove"} ).appendTo("body").trigger( "click" );
+
+ $("#remove").remove();
+});
+
+asyncTest( "handle submenu auto collapse: mouseleave", function() {
+ expect( 4 );
+ var $menu = $( "#menu2" ).menu();
+
+ $menu.find( "li:nth-child(7)" ).trigger( "mouseover" );
+ setTimeout(function() {
+ equal( $menu.find( "ul[aria-expanded='true']" ).length, 1, "first submenu expanded" );
+ $menu.find( "li:nth-child(7) li:first" ).trigger( "mouseover" );
+ setTimeout(function() {
+ equal( $menu.find( "ul[aria-expanded='true']" ).length, 2, "second submenu expanded" );
+ $menu.find( "ul[aria-expanded='true']:first" ).trigger( "mouseleave" );
+ equal( $menu.find( "ul[aria-expanded='true']" ).length, 1, "second submenu collapsed" );
+ $menu.trigger( "mouseleave" );
+ equal( $menu.find( "ul[aria-expanded='true']" ).length, 0, "first submenu collapsed" );
+ start();
+ }, 400);
+ }, 200);
+});
+
+asyncTest( "handle custom menu item submenu auto collapse: mouseleave", function() {
+ expect( 5 );
+ var $menu = $( "#menu5" ).menu( { items: "div" } );
+
+ $menu.children( ":nth-child(7)" ).trigger( "mouseover" );
+ setTimeout(function() {
+ equal( $menu.find( "div[aria-expanded='true']" ).length, 1, "first submenu expanded" );
+ $menu.children( ":nth-child(7)" ).find( "div:first" ).children( ":first" ).trigger( "mouseover" );
+ setTimeout(function() {
+ equal( $menu.find( "div[aria-expanded='true']" ).length, 2, "second submenu expanded" );
+ $menu.find( "div[aria-expanded='true']:first" ).trigger( "mouseleave" );
+ equal( $menu.find( "div[aria-expanded='true']" ).length, 1, "second submenu collapsed" );
+
+ $menu.simulate( "keydown", { keyCode: $.ui.keyCode.DOWN });
+ ok( $menu.find( ".ui-state-active" ).is( "#menu5 :nth-child(7) a" ),
+ "down keypress selected an item from the first submenu" );
+
+ $menu.trigger( "mouseleave" );
+ equal( $menu.find( "div[aria-expanded='true']" ).length, 0, "first submenu collapsed" );
+ start();
+ }, 400);
+ }, 200);
+});
+
+
test("handle keyboard navigation on menu without scroll and without submenus", function() {
expect(12);
var element = $('#menu1').menu({
diff --git a/tests/unit/menu/menu_test_helpers.js b/tests/unit/menu/menu_test_helpers.js
index 717cfc45d..e83795e5a 100644
--- a/tests/unit/menu/menu_test_helpers.js
+++ b/tests/unit/menu/menu_test_helpers.js
@@ -5,10 +5,10 @@ function menu_log( message, clear ) {
if ( message === undefined ) {
message = $( "#log" ).data( "lastItem" );
}
- $( "#log" ).prepend( message + "," );
+ $( "#log" ).prepend( $.trim( message ) + "," );
}
function menu_click( menu, item ) {
$( "#log" ).data( "lastItem", item );
- menu.find( "li:eq(" + item + ") a" ).trigger( "click" );
-}
+ menu.children( ":eq(" + item + ")" ).find( "a:first" ).trigger( "click" );
+} \ No newline at end of file
diff --git a/tests/unit/position/all.html b/tests/unit/position/all.html
index 00f7e3bba..8b300d011 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.6.2.js"></script>
+ <script src="../../../jquery-1.7.js"></script>
<link rel="stylesheet" href="../../../external/qunit.css">
<link rel="stylesheet" href="../subsuiteRunner.css">
diff --git a/tests/unit/position/position.html b/tests/unit/position/position.html
index a47e91004..115adc3e9 100644
--- a/tests/unit/position/position.html
+++ b/tests/unit/position/position.html
@@ -8,7 +8,12 @@
<script>
$.uiBackCompat = false;
</script>
- <script src="../../../ui/jquery.ui.position.js"></script>
+ <script src="../../resource_loader.js"></script>
+ <script>
+ loadResources({
+ js: [ "ui/jquery.ui.position.js" ]
+ });
+ </script>
<link rel="stylesheet" href="../../../external/qunit.css">
<script src="../../../external/qunit.js"></script>
@@ -16,7 +21,7 @@
<script src="../testsuite.js"></script>
<script src="position_core.js"></script>
- <script src="position_core_within.js"></script>
+ <script src="position_core_within.js"></script>
<script src="../swarminject.js"></script>
</head>
@@ -36,30 +41,34 @@ elements smaller than 10px have a line-height set on them to avoid a bug in IE6
-->
<div id="qunit-fixture" style="top: 0; left: 0; z-index:1">
- <div id="within-container">
- <div id="el1" style="position: absolute; width: 6px; height: 6px; line-height: 6px;"></div>
- <div id="el2" style="position: absolute; width: 6px; height: 6px; line-height: 6px;"></div>
- <div id="parent" style="position: absolute; width: 6px; height: 6px; top: 4px; left: 4px; line-height: 6px;"></div>
-
- <div style="position: absolute; top: 0px; left: 0px">
- <div id="elx" style="position: absolute; width: 10px; height: 10px; line-height: 10px;"></div>
- <div id="parentx" style="position: absolute; width: 20px; height: 20px; top: 40px; left: 40px;"></div>
- </div>
-
- <div style="position: absolute; top: 200px; left: 100px;">
- <div id="el-offset-100-200" style="position: absolute; width: 10px; height: 10px; line-height: 10px;"></div>
- <div style="position: absolute; top: 100px; left: 50px;">
- <div id="el-two-offset-150-300" style="position: absolute; width: 10px; height: 10px; line-height: 10px;"></div>
- <div id="el-fixed" style="position: fixed; top: 200px; left: 200px;"></div>
- </div>
- </div>
-
- <div style="position: absolute; height: 5000px; width: 5000px;"></div>
-
- <div id="bug-5280" style="height: 30px; width: 201px;">
- <div style="width: 50px; height: 10px;"></div>
- </div>
- </div>
+ <div id="within-container">
+ <div id="el1" style="position: absolute; width: 6px; height: 6px; line-height: 6px;"></div>
+ <div id="el2" style="position: absolute; width: 6px; height: 6px; line-height: 6px;"></div>
+ <div id="parent" style="position: absolute; width: 6px; height: 6px; top: 4px; left: 4px; line-height: 6px;"></div>
+
+ <div style="position: absolute; top: 0px; left: 0px">
+ <div id="elx" style="position: absolute; width: 10px; height: 10px; line-height: 10px;"></div>
+ <div id="parentx" style="position: absolute; width: 20px; height: 20px; top: 40px; left: 40px;"></div>
+ </div>
+
+ <div style="position: absolute; top: 200px; left: 100px;">
+ <div id="el-offset-100-200" style="position: absolute; width: 10px; height: 10px; line-height: 10px;"></div>
+ <div style="position: absolute; top: 100px; left: 50px;">
+ <div id="el-two-offset-150-300" style="position: absolute; width: 10px; height: 10px; line-height: 10px;"></div>
+ <div id="el-fixed" style="position: fixed; top: 200px; left: 200px;"></div>
+ </div>
+ </div>
+
+ <div style="position: absolute; height: 5000px; width: 5000px;"></div>
+
+ <div id="fractions-parent" style="position: absolute; left: 10.7432222px; top: 10.532325px; height: 30px; width: 201px;">
+ <div id="fractions-element"></div>
+ </div>
+ </div>
+
+ <div id="bug-5280" style="height: 30px; width: 201px;">
+ <div style="width: 50px; height: 10px;"></div>
+ </div>
</div>
</body>
diff --git a/tests/unit/position/position_core.js b/tests/unit/position/position_core.js
index fd6e643e9..ea1baee72 100644
--- a/tests/unit/position/position_core.js
+++ b/tests/unit/position/position_core.js
@@ -332,28 +332,28 @@ test( "collision: fit, window scrolled", function() {
test( "collision: flip, no offset", function() {
collisionTest({
collision: "flip"
- }, { top: -10, left: -10 }, "left top" );
+ }, { top: $( window ).height(), left: $( window ).width() }, "left top" );
collisionTest2({
collision: "flip"
- }, { top: $( window ).height(), left: $( window ).width() }, "right bottom" );
+ }, { top: -10, left: -10 }, "right bottom" );
});
test( "collision: flip, with offset", function() {
collisionTest({
collision: "flip",
at: "right+2 bottom+3"
- }, { top: -13, left: -12 }, "left top, with offset added" );
+ }, { top: $( window ).height() + 3, left: $( window ).width() + 2 }, "left top, with offset added" );
collisionTest2({
collision: "flip",
at: "left+2 top+3"
- }, { top: $( window ).height() - 3, left: $( window ).width() - 2 }, "bottom, positive offset" );
+ }, { top: -7, left: -8 }, "bottom, positive offset" );
collisionTest2({
collision: "flip",
at: "left-2 top-3"
- }, { top: $( window ).height() + 3, left: $( window ).width() + 2 }, "right bottom, negative offset" );
+ }, { top: -13, left: -12 }, "right bottom, negative offset" );
});
test( "collision: none, no offset", function() {
@@ -427,12 +427,12 @@ test( "collision: flip, with margin", function() {
collisionTest({
collision: "flip",
at: "left top"
- }, { top: $( window ).height() - 10, left: $( window ).width() - 10 }, "left top" );
+ }, { top: 0, left: 0 }, "left top" );
collisionTest2({
collision: "flip",
at: "right bottom"
- }, { top: 0, left: 0 }, "right bottom" );
+ }, { top: $( window ).height() - 10, left: $( window ).width() - 10 }, "right bottom" );
});
test( "addClass: flipped left", function() {
@@ -443,7 +443,7 @@ test( "addClass: flipped left", function() {
at: "right center"
});
- same( elem.hasClass( 'ui-flipped-left' ), true, 'Has ui-flipped-left class' );
+ same( elem.hasClass( 'ui-flipped-left' ), false, 'Has ui-flipped-left class' );
elem.position( {
my: "right center",
@@ -451,7 +451,7 @@ test( "addClass: flipped left", function() {
collision: "flip",
at: "left center"
})
-
+
same( elem.hasClass( 'ui-flipped-left' ), false, 'Removed ui-flipped-left class' );
});
@@ -463,8 +463,8 @@ test( "addClass: flipped top", function() {
at: "right bottom"
});
- same( elem.hasClass( 'ui-flipped-top' ), true, 'Has ui-flipped-top class' );
-
+ same( elem.hasClass( 'ui-flipped-top' ), false, 'Has ui-flipped-top class' );
+
elem.position( {
my: "left bottom",
of: window,
@@ -483,7 +483,7 @@ test( "addClass: flipped right", function() {
at: "left center"
});
- same( elem.hasClass( 'ui-flipped-right' ), true, 'Has ui-flipped-right class' );
+ same( elem.hasClass( 'ui-flipped-right' ), false, 'Has ui-flipped-right class' );
elem.position( {
my: "left center",
@@ -504,8 +504,8 @@ test( "addClass: flipped bottom", function() {
at: "right top"
});
- same( elem.hasClass( 'ui-flipped-bottom' ), true, 'Has ui-flipped-bottom class' );
-
+ same( elem.hasClass( 'ui-flipped-bottom' ), false, 'Has ui-flipped-bottom class' );
+
elem.position( {
my: "left top",
of: window,
@@ -516,22 +516,32 @@ test( "addClass: flipped bottom", function() {
same( elem.hasClass( 'ui-flipped-bottom' ), false, 'Removed ui-flipped-bottom class' );
});
-//test( "bug #5280: consistent results (avoid fractional values)", function() {
-// var wrapper = $( "#bug-5280" ),
-// elem = wrapper.children(),
-// offset1 = elem.position({
-// my: "center",
-// at: "center",
-// of: wrapper,
-// collision: "none"
-// }).offset(),
-// offset2 = elem.position({
-// my: "center",
-// at: "center",
-// of: wrapper,
-// collision: "none"
-// }).offset();
-// same( offset1, offset2 );
-//});
+test( "fractions", function() {
+ $( "#fractions-element" ).position({
+ my: "left top",
+ at: "left top",
+ of: "#fractions-parent",
+ collision: "none"
+ });
+ same( $( "#fractions-element" ).offset(), $( "#fractions-parent" ).offset(), "left top, left top" );
+});
+
+test( "bug #5280: consistent results (avoid fractional values)", function() {
+ var wrapper = $( "#bug-5280" ),
+ elem = wrapper.children(),
+ offset1 = elem.position({
+ my: "center",
+ at: "center",
+ of: wrapper,
+ collision: "none"
+ }).offset(),
+ offset2 = elem.position({
+ my: "center",
+ at: "center",
+ of: wrapper,
+ collision: "none"
+ }).offset();
+ same( offset1, offset2 );
+});
}( jQuery ) );
diff --git a/tests/unit/position/position_core_within.js b/tests/unit/position/position_core_within.js
index bfb913335..392e409c5 100644
--- a/tests/unit/position/position_core_within.js
+++ b/tests/unit/position/position_core_within.js
@@ -7,7 +7,7 @@ function scrollTopSupport() {
module( "position - within", {
setup: function(){
- $("#within-container").css({"width": "500px", "height": "500px", "top": "20px", "left": "20px", "position": "relative"}).show();
+ $("#within-container").css({"width": "70px", "height": "70px", "top": "20px", "left": "20px", "position": "relative"}).show();
}
});
@@ -20,13 +20,13 @@ $.fn.addOffsets = function() {
elOffset.top -= offset.top;
elOffset.left -= offset.left;
-
+
return {top: elOffset.top - offset.top, left: elOffset.left - offset.left };
};
test( "my, at, of", function() {
var within = $("#within-container");
-
+
$( "#elx" ).position({
my: "left top",
at: "left top",
@@ -121,7 +121,7 @@ test( "positions", function() {
test( "of", function() {
var within = $("#within-container");
-
+
$( "#elx" ).position({
my: "left top",
at: "left top",
@@ -178,7 +178,7 @@ test( "of", function() {
test( "within:offsets", function() {
var within = $("#within-container");
-
+
$( "#elx" ).position({
my: "left top",
at: "left+10 bottom+10",
@@ -218,7 +218,7 @@ test( "within:offsets", function() {
test( "using", function() {
expect( 6 );
-
+
var within = $("#within-container");
var count = 0,
@@ -226,7 +226,7 @@ test( "using", function() {
expectedPosition = { top: addTop + 40, left: addLeft + 40 },
originalPosition = elems.position({
my: "right bottom",
- at: "rigt bottom",
+ at: "right bottom",
of: "#parentx",
collision: "none",
within: within
@@ -253,14 +253,14 @@ test( "using", function() {
function collisionTest( config, result, msg ) {
var within = $("#within-container");
-
+
var elem = $( "#elx" ).position( $.extend({
my: "left top",
at: "right bottom",
- of: within[0],
+ of: "#parentx",
within: within
}, config ) );
-
+
same( elem.addOffsets(), result, msg );
}
@@ -272,128 +272,136 @@ function collisionTest2( config, result, msg ) {
}
test( "collision: fit, no offset", function() {
- var within = $("#within-container");
-
+ var within = $("#within-container"),
+ of = $("#parentx");
+
collisionTest({
collision: "fit"
- }, { top: addTop + within.height() - 10 - $.position.getScrollInfo( within ).height, left: addLeft + within.width() - 10 - $.position.getScrollInfo( within ).width }, "right bottom" );
+ }, { top: addTop + of.position().top + of.height() - $.position.getScrollInfo( within ).height, left: addLeft + of.position().left + of.width() - $.position.getScrollInfo( within ).width }, "right bottom" );
collisionTest2({
collision: "fit"
- }, { top: addTop + 0, left: addLeft + 0 }, "left top" );
+ }, { top: addTop + of.position().top - 10, left: addLeft + of.position().left - 10 }, "left top" );
});
test( "collision: fit, with offset", function() {
- var within = $("#within-container");
-
+ var within = $("#within-container"),
+ of = $("#parentx");
+
collisionTest({
collision: "fit",
at: "right+2 bottom+3"
- }, { top: addTop + within.height() - 10 - $.position.getScrollInfo( within ).height, left: addLeft + within.width() - 10 - $.position.getScrollInfo( within ).width }, "right bottom");
+ }, { top: addTop + of.position().top + of.height() - $.position.getScrollInfo( within ).height, left: addLeft + of.position().left + of.width() - $.position.getScrollInfo( within ).width }, "right bottom");
collisionTest2({
collision: "fit",
at: "left+2 top+3"
- }, { top: addTop + 0, left: addLeft + 0 }, "left top, positive offset" );
+ }, { top: addTop + of.position().top - 7, left: addLeft + of.position().left - 8 }, "left top, positive offset" );
collisionTest2({
collision: "fit",
at: "left-2 top-3"
- }, { top: addTop + 0, left: addLeft + 0 }, "left top, negative offset" );
+ }, { top: addTop + of.position().top - 13, left: addLeft + of.position().left - 12 }, "left top, negative offset" );
});
-test( "collision: fit, within scrolled", function() {
+test( "collision: none, within scrolled", function() {
if ( scrollTopSupport() ) {
- var within = $("#within-container").css({"width": "1000px", "height": "800px", "overflow": "auto"});
+ var within = $("#within-container").css({"width": "1000px", "height": "800px", "overflow": "auto"}),
+ of = $("#parentx");
within.scrollTop( 300 ).scrollLeft( 150 );
-
+
collisionTest({
- collision: "fit",
+ collision: "none",
at: "left-100 top-100"
- }, { top: addTop, left: addLeft }, "top left" );
+ }, { top: of.offset().top + addTop - 100 - of.height(), left: of.offset().left + addLeft - 100 - of.width() }, "top left" );
collisionTest2({
- collision: "fit",
+ collision: "none",
at: "right+100 bottom+100"
- }, { top: addTop + within.height() - 10 - $.position.getScrollInfo( within ).height, left: addLeft + within.width() - 10 - $.position.getScrollInfo( within ).width }, "right bottom" );
+ }, { top: of.offset().top + addTop + 100 - 10, left: of.offset().left + addLeft + 100 - 10 }, "right bottom" );
within.scrollTop( 0 ).scrollLeft( 0 );
}
});
-
+
test( "collision: flip, no offset", function() {
- var within = $("#within-container");
-
+ var within = $("#within-container"),
+ of = $("#parentx");
+
collisionTest({
collision: "flip"
- }, { top: addTop + -10, left: addLeft + -10 }, "left top" );
+ }, { top: addTop + of.position().top + of.height(), left: addLeft + of.position().left + of.width() }, "left top" );
collisionTest2({
collision: "flip"
- }, { top: addTop + within.height(), left: addLeft + within.width() }, "right bottom" );
+ }, { top: addTop + of.position().top - 10, left: addTop + of.position().top - 10 }, "right bottom" );
});
test( "collision: flip, with offset", function() {
- var within = $("#within-container");
-
+ var within = $("#within-container"),
+ of = $("#parentx");
+
collisionTest({
collision: "flip",
at: "right+2 bottom+3"
- }, { top: addTop + -13, left: addLeft + -12 }, "left top, with offset added" );
+ }, { top: addTop + of.position().top - 13, left: addLeft + of.position().left - 12 }, "left top, with offset added" );
collisionTest2({
collision: "flip",
at: "left+2 top+3"
- }, { top: addTop + within.height() - 3, left: addLeft + within.width() - 2 }, "bottom, positive offset" );
+ }, { top: addTop + of.position().top - 10 + 3, left: addLeft + of.position().left - 10 + 2 }, "right bottom, positive offset" );
collisionTest2({
collision: "flip",
at: "left-2 top-3"
- }, { top: addTop + within.height() + 3, left: addLeft + within.width() + 2 }, "right bottom, negative offset" );
+ }, { top: addTop + of.position().top - 13, left: addLeft + of.position().left - 12 }, "right bottom, negative offset" );
});
test( "collision: none, no offset", function() {
- var within = $("#within-container");
-
+ var within = $("#within-container"),
+ of = $("#parentx");
+
collisionTest({
collision: "none"
- }, { top: addTop + within.height(), left: addLeft + within.width() }, "left top" );
+ }, { top: addTop + of.position().top + of.height(), left: addLeft + of.position().left + of.width() }, "left top" );
collisionTest2({
collision: "none"
- }, { top: addTop + -10, left: addLeft + -10 }, "moved to the right bottom" );
+ }, { top: addTop + of.position().top - 10, left: addLeft + of.position().left - 10 }, "right bottom" );
});
test( "collision: none, with offset", function() {
- var within = $("#within-container");
-
+ var within = $("#within-container"),
+ of = $("#parentx");
+
collisionTest({
collision: "none",
at: "right+2 bottom+3"
- }, { top: addTop + within.height() + 3, left: addLeft + within.width() + 2 }, "right bottom, with offset added" );
+ }, { top: addTop + of.position().top + of.height() + 3, left: addLeft + of.position().left + of.width() + 2 }, "right bottom, with offset added" );
collisionTest2({
collision: "none",
at: "left+2 top+3"
- }, { top: addTop + -7, left: addLeft + -8 }, "left top, positive offset" );
+ }, { top: addTop + of.position().top - 7, left: addTop + of.position().top - 8 }, "left top, positive offset" );
collisionTest2({
collision: "none",
at: "left-2 top-3"
- }, { top: addTop + -13, left: addLeft + -12 }, "left top, negative offset" );
+ }, { top: addTop + of.position().top - 13, left: addTop + of.position().top - 12 }, "left top, negative offset" );
});
test( "collision: fit, with margin", function() {
- var within = $("#within-container");
-
+ var within = $("#within-container"),
+ of = $("#parentx");
+
$( "#elx" ).css( "margin", 10 );
collisionTest({
collision: "fit"
- }, { top: addTop + within.height() - 20 - $.position.getScrollInfo( within ).height, left: addLeft + within.width() - 20 - $.position.getScrollInfo( within ).width }, "right bottom" );
+ }, { top: addTop + of.position().top + of.height() - 10 - $.position.getScrollInfo( within ).height, left: addLeft + of.position().left + of.width() - 10 - $.position.getScrollInfo( within ).width }, "right bottom" );
collisionTest2({
collision: "fit"
- }, { top: addTop + 10, left: addLeft + 10 }, "left top" );
+ }, { top: addTop + of.position().top - 10, left: addLeft + of.position().left - 10 }, "left top" );
$( "#elx" ).css({
"margin-left": 5,
@@ -402,11 +410,11 @@ test( "collision: fit, with margin", function() {
collisionTest({
collision: "fit"
- }, { top: addTop + within.height() - 20 - $.position.getScrollInfo( within ).height, left: addLeft + within.width() - 20 - $.position.getScrollInfo( within ).width }, "right bottom" );
+ }, { top: addTop + of.position().top + of.height() - 10 - $.position.getScrollInfo( within ).height, left: addLeft + of.position().left + of.width() - 10 - $.position.getScrollInfo( within ).width }, "right bottom" );
collisionTest2({
collision: "fit"
- }, { top: addTop + 5, left: addLeft + 5 }, "left top" );
+ }, { top: addTop + of.position().top - 10, left: addLeft + of.position().left - 10 }, "left top" );
$( "#elx" ).css({
"margin-right": 15,
@@ -415,32 +423,33 @@ test( "collision: fit, with margin", function() {
collisionTest({
collision: "fit"
- }, { top: addTop + within.height() - 25 - $.position.getScrollInfo( within ).height, left: addLeft + within.width() - 25 - $.position.getScrollInfo( within ).width }, "right bottom" );
+ }, { top: addTop + of.position().top + of.height() - 15 - $.position.getScrollInfo( within ).height, left: addLeft + of.position().left + of.width() - 15 - $.position.getScrollInfo( within ).width }, "right bottom" );
collisionTest2({
collision: "fit"
- }, { top: addTop + 5, left: addLeft + 5 }, "left top" );
+ }, { top: addTop + of.position().top - 10, left: addLeft + of.position().left - 10 }, "left top" );
});
test( "collision: flip, with margin", function() {
- var within = $("#within-container");
-
+ var within = $("#within-container"),
+ of = $("#parentx");
+
$( "#elx" ).css( "margin", 10 );
collisionTest({
- collision: "flip",
- at: "left top"
- }, { top: addTop + within.height() - 10, left: addLeft + within.width() - 10 }, "left top" );
+ collision: "flip"
+ }, { top: addTop + of.position().top - 10, left: addLeft + of.position().left - 10 }, "left top" );
collisionTest2({
- collision: "flip",
- at: "right bottom"
- }, { top: addTop + 0, left: addLeft + 0 }, "right bottom" );
+ collision: "flip"
+ }, { top: addTop + of.position().top - 10, left: addLeft + of.position().left - 10 }, "right bottom" );
+
+ $( "#elx" ).css( "margin", 0 );
});
test( "addClass: flipped left", function() {
var within = $("#within-container");
-
+
var elem = $( "#elx" ).position( {
my: "left center",
of: within[0],
@@ -449,7 +458,7 @@ test( "addClass: flipped left", function() {
at: "right center"
});
- same( elem.hasClass( 'ui-flipped-left' ), true, 'Has ui-flipped-left class' );
+ same( elem.hasClass( 'ui-flipped-left' ), false, 'Has ui-flipped-left class' );
elem.position( {
my: "right center",
@@ -458,13 +467,13 @@ test( "addClass: flipped left", function() {
collision: "flip",
at: "left center"
})
-
+
same( elem.hasClass( 'ui-flipped-left' ), false, 'Removed ui-flipped-left class' );
});
test( "addClass: flipped top", function() {
var within = $("#within-container");
-
+
var elem = $( "#elx" ).position( {
my: "left top",
of: within[0],
@@ -473,8 +482,8 @@ test( "addClass: flipped top", function() {
at: "right bottom"
});
- same( elem.hasClass( 'ui-flipped-top' ), true, 'Has ui-flipped-top class' );
-
+ same( elem.hasClass( 'ui-flipped-top' ), false, 'Has ui-flipped-top class' );
+
elem.position( {
my: "left bottom",
of: within[0],
@@ -488,7 +497,7 @@ test( "addClass: flipped top", function() {
test( "addClass: flipped right", function() {
var within = $("#within-container");
-
+
var elem = $( "#elx" ).position( {
my: "right center",
of: within[0],
@@ -497,7 +506,7 @@ test( "addClass: flipped right", function() {
at: "left center"
});
- same( elem.hasClass( 'ui-flipped-right' ), true, 'Has ui-flipped-right class' );
+ same( elem.hasClass( 'ui-flipped-right' ), false, 'Has ui-flipped-right class' );
elem.position( {
my: "left center",
@@ -513,7 +522,7 @@ test( "addClass: flipped right", function() {
test( "addClass: flipped bottom", function() {
var within = $("#within-container");
-
+
var elem = $( "#elx" ).position( {
my: "left bottom",
of: window,
@@ -521,8 +530,8 @@ test( "addClass: flipped bottom", function() {
at: "right top"
});
- same( elem.hasClass( 'ui-flipped-bottom' ), true, 'Has ui-flipped-bottom class' );
-
+ same( elem.hasClass( 'ui-flipped-bottom' ), false, 'Has ui-flipped-bottom class' );
+
elem.position( {
my: "left top",
of: window,
diff --git a/tests/unit/position/position_deprecated.html b/tests/unit/position/position_deprecated.html
index 16d88ea2e..ee9be189d 100644
--- a/tests/unit/position/position_deprecated.html
+++ b/tests/unit/position/position_deprecated.html
@@ -5,7 +5,12 @@
<title>jQuery UI Position Test Suite</title>
<script src="../../jquery.js"></script>
- <script src="../../../ui/jquery.ui.position.js"></script>
+ <script src="../../resource_loader.js"></script>
+ <script>
+ loadResources({
+ js: [ "ui/jquery.ui.position.js" ]
+ });
+ </script>
<link rel="stylesheet" href="../../../external/qunit.css">
<script src="../../../external/qunit.js"></script>
@@ -55,5 +60,9 @@ elements smaller than 10px have a line-height set on them to avoid a bug in IE6
<div style="width: 50px; height: 10px;"></div>
</div>
+<div id="fractions-parent" style="position: absolute; left: 10.7432222px; top: 10.532325px; height: 30px; width: 201px;">
+ <div id="fractions-element"></div>
+</div>
+
</body>
</html>
diff --git a/tests/unit/progressbar/all.html b/tests/unit/progressbar/all.html
index 8f5f0ed26..73126b35c 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.6.2.js"></script>
+ <script src="../../../jquery-1.7.js"></script>
<link rel="stylesheet" href="../../../external/qunit.css">
<link rel="stylesheet" href="../subsuiteRunner.css">
diff --git a/tests/unit/progressbar/progressbar.html b/tests/unit/progressbar/progressbar.html
index b708af265..8b55f5a89 100644
--- a/tests/unit/progressbar/progressbar.html
+++ b/tests/unit/progressbar/progressbar.html
@@ -4,13 +4,18 @@
<meta charset="utf-8">
<title>jQuery UI Progressbar Test Suite</title>
- <link rel="stylesheet" href="../../../themes/base/jquery.ui.core.css">
- <link rel="stylesheet" href="../../../themes/base/jquery.ui.progressbar.css">
-
<script src="../../jquery.js"></script>
- <script src="../../../ui/jquery.ui.core.js"></script>
- <script src="../../../ui/jquery.ui.widget.js"></script>
- <script src="../../../ui/jquery.ui.progressbar.js"></script>
+ <script src="../../resource_loader.js"></script>
+ <script>
+ loadResources({
+ css: [ "ui.core", "ui.progressbar" ],
+ js: [
+ "ui/jquery.ui.core.js",
+ "ui/jquery.ui.widget.js",
+ "ui/jquery.ui.progressbar.js"
+ ]
+ });
+ </script>
<link rel="stylesheet" href="../../../external/qunit.css">
<script src="../../../external/qunit.js"></script>
diff --git a/tests/unit/resizable/all.html b/tests/unit/resizable/all.html
index f496ed5a7..66ade12a8 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.6.2.js"></script>
+ <script src="../../../jquery-1.7.js"></script>
<link rel="stylesheet" href="../../../external/qunit.css">
<link rel="stylesheet" href="../subsuiteRunner.css">
diff --git a/tests/unit/resizable/resizable.html b/tests/unit/resizable/resizable.html
index f1b2f1bc3..4e886d2fd 100644
--- a/tests/unit/resizable/resizable.html
+++ b/tests/unit/resizable/resizable.html
@@ -4,14 +4,19 @@
<meta charset="utf-8">
<title>jQuery UI Resizable Test Suite</title>
- <link rel="stylesheet" href="../../../themes/base/jquery.ui.core.css">
- <link rel="stylesheet" href="../../../themes/base/jquery.ui.resizable.css">
-
<script src="../../jquery.js"></script>
- <script src="../../../ui/jquery.ui.core.js"></script>
- <script src="../../../ui/jquery.ui.widget.js"></script>
- <script src="../../../ui/jquery.ui.mouse.js"></script>
- <script src="../../../ui/jquery.ui.resizable.js"></script>
+ <script src="../../resource_loader.js"></script>
+ <script>
+ loadResources({
+ css: [ "ui.core", "ui.resizable" ],
+ js: [
+ "ui/jquery.ui.core.js",
+ "ui/jquery.ui.widget.js",
+ "ui/jquery.ui.mouse.js",
+ "ui/jquery.ui.resizable.js"
+ ]
+ });
+ </script>
<link rel="stylesheet" href="../../../external/qunit.css">
<script src="../../../external/qunit.js"></script>
diff --git a/tests/unit/selectable/all.html b/tests/unit/selectable/all.html
index e8098a53e..f75846c85 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.6.2.js"></script>
+ <script src="../../../jquery-1.7.js"></script>
<link rel="stylesheet" href="../../../external/qunit.css">
<link rel="stylesheet" href="../subsuiteRunner.css">
diff --git a/tests/unit/selectable/selectable.html b/tests/unit/selectable/selectable.html
index 4d6150691..4f70e8dd4 100644
--- a/tests/unit/selectable/selectable.html
+++ b/tests/unit/selectable/selectable.html
@@ -5,10 +5,18 @@
<title>jQuery UI Selectable Test Suite</title>
<script src="../../jquery.js"></script>
- <script src="../../../ui/jquery.ui.core.js"></script>
- <script src="../../../ui/jquery.ui.widget.js"></script>
- <script src="../../../ui/jquery.ui.mouse.js"></script>
- <script src="../../../ui/jquery.ui.selectable.js"></script>
+ <script src="../../resource_loader.js"></script>
+ <script>
+ loadResources({
+ css: [ "ui.core", "ui.selectable" ],
+ js: [
+ "ui/jquery.ui.core.js",
+ "ui/jquery.ui.widget.js",
+ "ui/jquery.ui.mouse.js",
+ "ui/jquery.ui.selectable.js"
+ ]
+ });
+ </script>
<link rel="stylesheet" href="../../../external/qunit.css">
<script src="../../../external/qunit.js"></script>
diff --git a/tests/unit/slider/all.html b/tests/unit/slider/all.html
index 99d96c118..382b0da3d 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.6.2.js"></script>
+ <script src="../../../jquery-1.7.js"></script>
<link rel="stylesheet" href="../../../external/qunit.css">
<link rel="stylesheet" href="../subsuiteRunner.css">
diff --git a/tests/unit/slider/slider.html b/tests/unit/slider/slider.html
index 3fe3b3588..60d124b7a 100644
--- a/tests/unit/slider/slider.html
+++ b/tests/unit/slider/slider.html
@@ -4,13 +4,19 @@
<meta charset="utf-8">
<title>jQuery UI Slider Test Suite</title>
- <link rel="stylesheet" href="../../../themes/base/jquery.ui.slider.css">
-
<script src="../../jquery.js"></script>
- <script src="../../../ui/jquery.ui.core.js"></script>
- <script src="../../../ui/jquery.ui.widget.js"></script>
- <script src="../../../ui/jquery.ui.mouse.js"></script>
- <script src="../../../ui/jquery.ui.slider.js"></script>
+ <script src="../../resource_loader.js"></script>
+ <script>
+ loadResources({
+ css: [ "ui.core", "ui.slider" ],
+ js: [
+ "ui/jquery.ui.core.js",
+ "ui/jquery.ui.widget.js",
+ "ui/jquery.ui.mouse.js",
+ "ui/jquery.ui.slider.js"
+ ]
+ });
+ </script>
<link rel="stylesheet" href="../../../external/qunit.css">
<script src="../../../external/qunit.js"></script>
diff --git a/tests/unit/sortable/all.html b/tests/unit/sortable/all.html
index ec5d9391d..48001215f 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.6.2.js"></script>
+ <script src="../../../jquery-1.7.js"></script>
<link rel="stylesheet" href="../../../external/qunit.css">
<link rel="stylesheet" href="../subsuiteRunner.css">
diff --git a/tests/unit/sortable/sortable.html b/tests/unit/sortable/sortable.html
index 40eed6652..a20eb7109 100644
--- a/tests/unit/sortable/sortable.html
+++ b/tests/unit/sortable/sortable.html
@@ -5,10 +5,18 @@
<title>jQuery UI Sortable Test Suite</title>
<script src="../../jquery.js"></script>
- <script src="../../../ui/jquery.ui.core.js"></script>
- <script src="../../../ui/jquery.ui.widget.js"></script>
- <script src="../../../ui/jquery.ui.mouse.js"></script>
- <script src="../../../ui/jquery.ui.sortable.js"></script>
+ <script src="../../resource_loader.js"></script>
+ <script>
+ loadResources({
+ css: [ "ui.core", "ui.sortable" ],
+ js: [
+ "ui/jquery.ui.core.js",
+ "ui/jquery.ui.widget.js",
+ "ui/jquery.ui.mouse.js",
+ "ui/jquery.ui.sortable.js"
+ ]
+ });
+ </script>
<link rel="stylesheet" href="../../../external/qunit.css">
<script src="../../../external/qunit.js"></script>
diff --git a/tests/unit/spinner/all.html b/tests/unit/spinner/all.html
index 17ae4d164..e6e329fad 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.6.2.js"></script>
+ <script src="../../../jquery-1.7.js"></script>
<link rel="stylesheet" href="../../../external/qunit.css">
<link rel="stylesheet" href="../subsuiteRunner.css">
diff --git a/tests/unit/spinner/spinner.html b/tests/unit/spinner/spinner.html
index ddfb03d91..0c01a5f48 100644
--- a/tests/unit/spinner/spinner.html
+++ b/tests/unit/spinner/spinner.html
@@ -4,15 +4,22 @@
<meta charset="utf-8">
<title>jQuery UI Spinner Test Suite</title>
- <link rel="stylesheet" href="../../../themes/base/jquery.ui.spinner.css">
-
<script src="../../jquery.js"></script>
<script src="../../../external/jquery.mousewheel-3.0.4.js"></script>
<script src="../../../external/globalize.js"></script>
- <script src="../../../ui/jquery.ui.core.js"></script>
- <script src="../../../ui/jquery.ui.widget.js"></script>
- <script src="../../../ui/jquery.ui.button.js"></script>
- <script src="../../../ui/jquery.ui.spinner.js"></script>
+ <script src="../../../external/globalize.culture.ja-JP.js"></script>
+ <script src="../../resource_loader.js"></script>
+ <script>
+ loadResources({
+ css: [ "ui.core", "ui.button", "ui.spinner" ],
+ js: [
+ "ui/jquery.ui.core.js",
+ "ui/jquery.ui.widget.js",
+ "ui/jquery.ui.button.js",
+ "ui/jquery.ui.spinner.js"
+ ]
+ });
+ </script>
<link rel="stylesheet" href="../../../external/qunit.css">
<script src="../../../external/qunit.js"></script>
diff --git a/tests/unit/spinner/spinner_core.js b/tests/unit/spinner/spinner_core.js
index 55b806a7f..e12d1af2f 100644
--- a/tests/unit/spinner/spinner_core.js
+++ b/tests/unit/spinner/spinner_core.js
@@ -4,9 +4,8 @@ module( "spinner: core" );
test( "keydown UP on input, increases value not greater than max", function() {
expect( 5 );
- var element = $( "#spin" ).spinner({
+ var element = $( "#spin" ).val( 70 ).spinner({
max: 100,
- value: 70,
step: 10
});
@@ -24,9 +23,8 @@ test( "keydown UP on input, increases value not greater than max", function() {
test( "keydown DOWN on input, decreases value not less than min", function() {
expect( 5 );
- var element = $( "#spin" ).spinner({
+ var element = $( "#spin" ).val( 50 ).spinner({
min: 20,
- value: 50,
step: 10
});
@@ -44,9 +42,8 @@ test( "keydown DOWN on input, decreases value not less than min", function() {
test( "keydown PAGE_UP on input, increases value not greater than max", function() {
expect( 5 );
- var element = $( "#spin" ).spinner({
+ var element = $( "#spin" ).val( 70 ).spinner({
max: 100,
- value: 70,
page: 10
});
@@ -64,9 +61,8 @@ test( "keydown PAGE_UP on input, increases value not greater than max", function
test( "keydown PAGE_DOWN on input, decreases value not less than min", function() {
expect( 5 );
- var element = $( "#spin" ).spinner({
+ var element = $( "#spin" ).val( 50 ).spinner({
min: 20,
- value: 50,
page: 10
});
@@ -84,9 +80,8 @@ test( "keydown PAGE_DOWN on input, decreases value not less than min", function(
test( "mouse click on up button, increases value not greater than max", function() {
expect( 3 );
- var element = $( "#spin" ).spinner({
- max: 20,
- value: 18
+ var element = $( "#spin" ).val( 18 ).spinner({
+ max: 20
}),
button = element.spinner( "widget" ).find( ".ui-spinner-up" );
@@ -100,9 +95,8 @@ test( "mouse click on up button, increases value not greater than max", function
test( "mouse click on up button, increases value not greater than max", function() {
expect( 3 );
- var element = $( "#spin" ).spinner({
- min: 0,
- value: 2
+ var element = $( "#spin" ).val( 2 ).spinner({
+ min: 0
}),
button = element.spinner( "widget" ).find( ".ui-spinner-down" );
@@ -115,14 +109,12 @@ test( "mouse click on up button, increases value not greater than max", function
});
test( "mousewheel on input", function() {
- expect( 5 );
+ expect( 4 );
- var element = $( "#spin" ).spinner({
+ var element = $( "#spin" ).val( 0 ).spinner({
step: 2
});
- equal( element.val(), 0 );
-
element.trigger( "mousewheel" );
equal( element.val(), 0, "mousewheel event without delta does not change value" );
@@ -137,10 +129,9 @@ test( "mousewheel on input", function() {
});
test( "reading HTML5 attributes", function() {
- expect( 8 );
+ expect( 6 );
var markup = "<input type='number' min='-100' max='100' value='5' step='2'>",
element = $( markup ).spinner();
- equal( element.spinner( "option", "value" ), 5, "value from markup" );
equal( element.spinner( "option", "min" ), -100, "min from markup" );
equal( element.spinner( "option", "max" ), 100, "max from markup" );
equal( element.spinner( "option", "step" ), 2, "step from markup" );
@@ -148,32 +139,36 @@ test( "reading HTML5 attributes", function() {
element = $( markup ).spinner({
min: -200,
max: 200,
- value: 20,
step: 5
});
- equal( element.spinner( "option", "value" ), 20, "value from options" );
equal( element.spinner( "option", "min" ), -200, "min from options" );
equal( element.spinner( "option", "max" ), 200, "max from options" );
equal( element.spinner( "option", "step" ), 5, "stop from options" );
});
test( "ARIA attributes", function() {
- expect( 7 );
- var element = $( "#spin" ).spinner({ min: -5, max: 5, value: 2 });
+ expect( 9 );
+ var element = $( "#spin" ).val( 2 ).spinner({ min: -5, max: 5 });
equal( element.attr( "role" ), "spinbutton", "role" );
- equal( element.attr( "aria-valuemin" ), -5, "aria-valuemin" );
- equal( element.attr( "aria-valuemax" ), 5, "aria-valuemax" );
- equal( element.attr( "aria-valuenow" ), 2, "aria-valuenow" );
+ equal( element.attr( "aria-valuemin" ), "-5", "aria-valuemin" );
+ equal( element.attr( "aria-valuemax" ), "5", "aria-valuemax" );
+ equal( element.attr( "aria-valuenow" ), "2", "aria-valuenow" );
element.spinner( "stepUp" );
- equal( element.attr( "aria-valuenow" ), 3, "stepUp 1 step changes aria-valuenow" );
+ equal( element.attr( "aria-valuenow" ), "3", "stepUp 1 step changes aria-valuenow" );
element.spinner( "option", { min: -10, max: 10 } );
- equal( element.attr( "aria-valuemin" ), -10, "min option changed aria-valuemin changes" );
- equal( element.attr( "aria-valuemax" ), 10, "max option changed aria-valuemax changes" );
+ equal( element.attr( "aria-valuemin" ), "-10", "min option changed aria-valuemin changes" );
+ equal( element.attr( "aria-valuemax" ), "10", "max option changed aria-valuemax changes" );
+
+ element.spinner( "option", "min", null );
+ equal( element.attr( "aria-valuemin" ), undefined, "aria-valuemin not set when no min" );
+
+ element.spinner( "option", "max", null );
+ equal( element.attr( "aria-valuemax" ), undefined, "aria-valuemax not set when no max" );
});
test( "focus text field when pressing button", function() {
@@ -185,4 +180,27 @@ test( "focus text field when pressing button", function() {
ok( element[ 0 ] === document.activeElement, "focused after" );
});
+test( "don't clear invalid value on blur", function() {
+ expect( 1 );
+ var element = $( "#spin" ).spinner();
+ element.focus().val( "a" ).blur();
+ equal( element.val(), "a" );
+});
+
+test( "precision", function() {
+ expect( 2 );
+ var element = $( "#spin" ).val( .05 ).spinner({
+ step: .0001
+ });
+ element.spinner( "stepUp" );
+ equal( element.val(), "0.0501", "precision from step" );
+
+ element.val( 1.05 ).spinner( "option", {
+ step: 1,
+ min: -9.95
+ });
+ element.spinner( "stepDown" );
+ equal( element.val(), "0.05", "precision from min" );
+});
+
})( jQuery );
diff --git a/tests/unit/spinner/spinner_defaults.js b/tests/unit/spinner/spinner_defaults.js
index 18949ff90..0a4e7c236 100644
--- a/tests/unit/spinner/spinner_defaults.js
+++ b/tests/unit/spinner/spinner_defaults.js
@@ -1,13 +1,13 @@
commonWidgetTests( "spinner", {
defaults: {
+ culture: null,
disabled: false,
incremental: true,
- max: Number.MAX_VALUE,
- min: -Number.MAX_VALUE,
+ max: null,
+ min: null,
numberFormat: null,
page: 10,
step: 1,
- value: 0,
// callbacks
change: null,
diff --git a/tests/unit/spinner/spinner_events.js b/tests/unit/spinner/spinner_events.js
index e9f5da1ce..e43ba3365 100644
--- a/tests/unit/spinner/spinner_events.js
+++ b/tests/unit/spinner/spinner_events.js
@@ -129,24 +129,28 @@ test( "change", function() {
});
}
+ element.focus();
shouldChange( false, "key UP, before blur" );
spinner_simulateKeyDownUp( element, $.ui.keyCode.UP );
shouldChange( true, "blur after key UP" );
element.blur();
+ element.focus();
shouldChange( false, "key DOWN, before blur" );
spinner_simulateKeyDownUp( element, $.ui.keyCode.DOWN );
shouldChange( true, "blur after key DOWN" );
element.blur();
+ element.focus();
shouldChange( false, "key PAGE_UP, before blur" );
spinner_simulateKeyDownUp( element, $.ui.keyCode.PAGE_UP );
shouldChange( true, "blur after key PAGE_UP" );
element.blur();
+ element.focus();
shouldChange( false, "key PAGE_DOWN, before blur" );
spinner_simulateKeyDownUp( element, $.ui.keyCode.PAGE_DOWN );
- shouldChange( true, "key PAGE_DOWN" );
+ shouldChange( true, "blur after key PAGE_DOWN" );
element.blur();
shouldChange( false, "many keys, before blur" );
diff --git a/tests/unit/spinner/spinner_methods.js b/tests/unit/spinner/spinner_methods.js
index 29494f9cc..a9fd6c889 100644
--- a/tests/unit/spinner/spinner_methods.js
+++ b/tests/unit/spinner/spinner_methods.js
@@ -11,7 +11,7 @@ test( "destroy", function() {
test( "disable", function() {
expect( 14 );
- var element = $( "#spin" ).spinner({ value: 2 }),
+ var element = $( "#spin" ).val( 2 ).spinner(),
wrapper = $( "#spin" ).spinner( "widget" );
ok( !wrapper.hasClass( "ui-spinner-disabled" ), "before: wrapper does not have ui-spinner-disabled class" );
@@ -54,7 +54,7 @@ test( "disable", function() {
test( "enable", function() {
expect( 5 );
- var element = $( "#spin" ).spinner({ disabled: true })
+ var element = $( "#spin" ).val( 1 ).spinner({ disabled: true })
wrapper = element.spinner( "widget" );
ok( wrapper.hasClass( "ui-spinner-disabled" ), "before: wrapper has ui-spinner-disabled class" );
@@ -66,14 +66,13 @@ test( "enable", function() {
ok( !element.is( ":disabled" ), "after: input does not have disabled attribute" );
spinner_simulateKeyDownUp( element, $.ui.keyCode.UP );
- equals( 1, element.val(), "keyboard - value does not change on key UP" );
+ equals( 2, element.val(), "keyboard - value changes on key UP" );
});
test( "pageDown", function() {
expect( 4 );
- var element = $( "#spin" ).spinner({
+ var element = $( "#spin" ).val( -12 ).spinner({
page: 20,
- value: -12,
min: -100
});
@@ -92,9 +91,8 @@ test( "pageDown", function() {
test( "pageUp", function() {
expect( 4 );
- var element = $( "#spin" ).spinner({
+ var element = $( "#spin" ).val( 12 ).spinner({
page: 20,
- value: 12,
max: 100
});
@@ -113,31 +111,29 @@ test( "pageUp", function() {
test( "stepDown", function() {
expect( 4 );
- var element = $( "#spin" ).spinner({
+ var element = $( "#spin" ).val( 0 ).spinner({
step: 2,
- value: 0,
min: -15
});
element.spinner( "stepDown" );
- equals( element.val(), -2, "stepDown 1 step" );
+ equals( element.val(), "-1", "stepDown 1 step" );
element.spinner( "stepDown", 5 );
- equals( element.val(), -12, "stepDown 5 steps" );
+ equals( element.val(), "-11", "stepDown 5 steps" );
element.spinner( "stepDown", 4 );
- equals( element.val(), -15, "close to min and stepDown 4 steps" );
+ equals( element.val(), "-15", "close to min and stepDown 4 steps" );
element.spinner( "stepDown" );
- equals( element.val(), -15, "at min and stepDown 1 step" );
+ equals( element.val(), "-15", "at min and stepDown 1 step" );
});
test( "stepUp", function() {
expect( 4 );
- var element = $( "#spin" ).spinner({
+ var element = $( "#spin" ).val( 0 ).spinner({
step: 2,
- value: 0,
- max: 15
+ max: 16
});
element.spinner( "stepUp" );
@@ -147,20 +143,22 @@ test( "stepUp", function() {
equals( element.val(), 12, "stepUp 5 steps" );
element.spinner( "stepUp", 4 );
- equals( element.val(), 15, "close to min and stepUp 4 steps" );
+ equals( element.val(), 16, "close to min and stepUp 4 steps" );
element.spinner( "stepUp" );
- equals( element.val(), 15, "at max and stepUp 1 step" );
+ equals( element.val(), 16, "at max and stepUp 1 step" );
});
test( "value", function() {
expect( 2 );
- var element = $( "#spin" ).spinner({ value: 0 });
+ var element = $( "#spin" ).val( 0 ).spinner({
+ step: 3
+ });
element.spinner( "value", 10 );
- equals( element.val(), 10, "change value via value method" );
+ equals( element.val(), 9, "change value via value method" );
- equals( element.spinner( "value" ), 10, "get value via value method" );
+ equals( element.spinner( "value" ), 9, "get value via value method" );
});
})( jQuery );
diff --git a/tests/unit/spinner/spinner_options.js b/tests/unit/spinner/spinner_options.js
index 30155e755..81f434fc6 100644
--- a/tests/unit/spinner/spinner_options.js
+++ b/tests/unit/spinner/spinner_options.js
@@ -2,121 +2,189 @@
module( "spinner: options" );
-test( "numberFormat, number", function() {
- expect( 1 );
- var element = $( "#spin" ).spinner({
- value: "1",
- numberFormat: "n"
- });
- equal( element.val(), "1.00", "n" );
+// culture is tested after numberFormat, since it depends on numberFormat
+
+test( "incremental, false", function() {
+ expect( 100 );
+
+ var i, diff,
+ prev = 0,
+ element = $( "#spin" ).val( prev ).spinner({
+ incremental: false,
+ spin: function( event, ui ) {
+ equal( ui.value - prev, 1 );
+ prev = ui.value;
+ }
+ });
+
+ for ( i = 0; i < 100; i++ ) {
+ element.simulate( "keydown", { keyCode: $.ui.keyCode.UP } );
+ }
+ element.simulate( "keyup", { keyCode: $.ui.keyCode.UP } );
});
-test( "numberFormat, number, simple", function() {
- expect( 1 );
- var element = $( "#spin" ).spinner({
- value: "1",
- numberFormat: "n0"
- });
- equal( element.val(), "1", "n0" );
-});
+test( "incremental, true", function() {
+ expect( 100 );
-test( "numberFormat, currency", function() {
- expect( 1 );
- var element = $( "#spin" ).spinner({
- value: "1",
- numberFormat: "C"
- });
- equal( element.val(), "$1.00", "C" );
-});
+ function fill( num, val ) {
+ return $.map( new Array( num ), function() {
+ return val;
+ });
+ }
-/* TODO figure out how to test this properly
-test("incremental - false (default)", function() {
- var el = $("#spin").spinner({ incremental:false });
+ var i, diff,
+ prev = 0,
+ expected = [].concat( fill( 18, 1 ), fill( 37, 2 ), fill( 14, 3 ),
+ fill( 9, 4 ), fill( 6, 5 ), fill( 5, 6 ), fill ( 5, 7 ),
+ fill( 4, 8 ), fill( 2, 9 ) ),
+ element = $( "#spin" ).val( prev ).spinner({
+ incremental: true,
+ spin: function( event, ui ) {
+ equal( ui.value - prev, expected[ i ] );
+ prev = ui.value;
+ }
+ });
+
+ for ( i = 0; i < 100; i++ ) {
+ element.simulate( "keydown", { keyCode: $.ui.keyCode.UP } );
+ }
+ element.simulate( "keyup", { keyCode: $.ui.keyCode.UP } );
+});
- for ( var i = 1 ; i<=120 ; i++ ) {
- el.simulate("keydown",{keyCode:$.ui.keyCode.UP});
+test( "incremental, function", function() {
+ expect( 100 );
+
+ var i,
+ prev = 0,
+ element = $( "#spin" ).val( prev ).spinner({
+ incremental: function( i ) {
+ return i;
+ },
+ spin: function( event, ui ) {
+ equal( ui.value - prev, i + 1 );
+ prev = ui.value;
+ }
+ });
+
+ for ( i = 0; i < 100; i++ ) {
+ element.simulate( "keydown", { keyCode: $.ui.keyCode.UP } );
}
- el.simulate("keyup",{keyCode:$.ui.keyCode.UP});
+ element.simulate( "keyup", { keyCode: $.ui.keyCode.UP } );
+});
- equals(el.val(), 120, "incremental false - keydown 120 times");
+test( "numberFormat, number", function() {
+ expect( 2 );
+ var element = $( "#spin" ).val( 0 ).spinner({ numberFormat: "n" });
+ equal( element.val(), "0.00", "formatted on init" );
+ element.spinner( "stepUp" );
+ equal( element.val(), "1.00", "formatted after step" );
+});
- for ( var i = 1 ; i<=210 ; i++ ) {
- el.simulate("keydown",{keyCode:$.ui.keyCode.DOWN});
- }
- el.simulate("keyup",{keyCode:$.ui.keyCode.DOWN});
+test( "numberFormat, number, simple", function() {
+ expect( 2 );
+ var element = $( "#spin" ).val( 0 ).spinner({ numberFormat: "n0" });
+ equal( element.val(), "0", "formatted on init" );
+ element.spinner( "stepUp" );
+ equal( element.val(), "1", "formatted after step" );
+});
- equals(el.val(), -90, "incremental false - keydown 210 times");
+test( "numberFormat, currency", function() {
+ expect( 2 );
+ var element = $( "#spin" ).val( 0 ).spinner({ numberFormat: "C" });
+ equal( element.val(), "$0.00", "formatted on init" );
+ element.spinner( "stepUp" );
+ equal( element.val(), "$1.00", "formatted after step" );
});
-test("incremental - true (default)", function() {
- var el = $("#spin").spinner();
+test( "numberFormat, change", function() {
+ expect( 2 );
+ var element = $( "#spin" ).val( 5 ).spinner({ numberFormat: "n1" });
+ equal( element.val(), "5.0", "formatted on init" );
+ element.spinner( "option", "numberFormat", "c" );
+ equal( element.val(), "$5.00", "formatted after change" );
+});
- for ( var i = 1 ; i<=120 ; i++ ) {
- el.simulate("keydown",{keyCode:$.ui.keyCode.UP});
- }
- el.simulate("keyup",{keyCode:$.ui.keyCode.UP});
+test( "culture, null", function() {
+ expect( 2 );
+ Globalize.culture( "ja-JP" );
+ var element = $( "#spin" ).val( 0 ).spinner({ numberFormat: "C" });
+ equal( element.val(), "¥0", "formatted on init" );
+ element.spinner( "stepUp" );
+ equal( element.val(), "¥1", "formatted after step" );
- equals(el.val(), 300, "incremental true - keydown 120 times (100+20*10)");
+ // reset culture
+ Globalize.culture( "default" );
+});
- for ( var i = 1 ; i<=210 ; i++ ) {
- el.simulate("keydown",{keyCode:$.ui.keyCode.DOWN});
- }
- el.simulate("keyup",{keyCode:$.ui.keyCode.DOWN});
+test( "currency, ja-JP", function() {
+ expect( 2 );
+ var element = $( "#spin" ).val( 0 ).spinner({
+ numberFormat: "C",
+ culture: "ja-JP"
+ });
+ equal( element.val(), "¥0", "formatted on init" );
+ element.spinner( "stepUp" );
+ equal( element.val(), "¥1", "formatted after step" );
+});
- equals(el.val(), -1800, "incremental true - keydown 210 times (300-100-100*10-10*100)");
+test( "currency, change", function() {
+ expect( 2 );
+ var element = $( "#spin" ).val( 5 ).spinner({
+ numberFormat: "C",
+ culture: "ja-JP"
+ });
+ equal( element.val(), "¥5", "formatted on init" );
+ element.spinner( "option", "culture", "en" );
+ equal( element.val(), "$5.00", "formatted after change" );
});
-*/
test( "max", function() {
expect( 3 );
- var element = $( "#spin" ).spinner({ max: 100, value: 1000 });
- equals( element.val(), 100, "max constrained if value option is greater" );
+ var element = $( "#spin" ).val( 1000 ).spinner({ max: 100 });
+ equals( element.val(), 1000, "value not constrained on init" );
element.spinner( "value", 1000 );
equals( element.val(), 100, "max constrained if value method is greater" );
element.val( 1000 ).blur();
- equals( element.val(), 100, "max constrained if manual entry" );
+ equals( element.val(), 1000, "max not constrained if manual entry" );
});
test( "min", function() {
expect( 3 );
- var element = $( "#spin" ).spinner({ min: -100, value: -1000 });
- equals( element.val(), -100, "min constrained if value option is greater" );
+ var element = $( "#spin" ).val( -1000 ).spinner({ min: -100 });
+ equals( element.val(), -1000, "value not constrained on init" );
element.spinner( "value", -1000 );
equals( element.val(), -100, "min constrained if value method is greater" );
element.val( -1000 ).blur();
- equals( element.val(), -100, "min constrained if manual entry" );
+ equals( element.val(), -1000, "min not constrained if manual entry" );
});
test( "step, 2", function() {
- expect( 4 );
- var element = $( "#spin" ).spinner({ step: 2 });
- equals( element.val(), "0", "value initialized to 0" );
+ expect( 3 );
+ var element = $( "#spin" ).val( 0 ).spinner({ step: 2 });
element.spinner( "stepUp" );
equals( element.val(), "2", "stepUp" );
element.spinner( "value", "10.5" );
- equals( element.val(), "10.5", "value reset to 10.5" );
+ equals( element.val(), "10", "value reset to 10" );
+ element.val( "4.5" );
element.spinner( "stepUp" );
- equals( element.val(), "12.5", "stepUp" );
+ equals( element.val(), "6", "stepUp" );
});
test( "step, 0.7", function() {
- expect( 2 );
- var element = $("#spin").spinner({
+ expect( 1 );
+ var element = $("#spin").val( 0 ).spinner({
step: 0.7
});
- equals( element.val(), "0", "value initialized to 0" );
element.spinner( "stepUp" );
equals( element.val(), "0.7", "stepUp" );
});
-// TODO: test value
-
})( jQuery );
diff --git a/tests/unit/subsuite.js b/tests/unit/subsuite.js
index 90dc550f1..7818b6ff0 100644
--- a/tests/unit/subsuite.js
+++ b/tests/unit/subsuite.js
@@ -1,6 +1,6 @@
(function() {
-var versions = [ "1.6", "1.6.1", "1.6.2", "git" ];
+var versions = [ "1.6", "1.6.1", "1.6.2", "1.6.3", "1.6.4", "1.7", "git" ];
var additionalTests = {
accordion: [ "accordion_deprecated.html" ],
diff --git a/tests/unit/tabs/all.html b/tests/unit/tabs/all.html
index e5c41ba9b..58a1cb962 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.6.2.js"></script>
+ <script src="../../../jquery-1.7.js"></script>
<link rel="stylesheet" href="../../../external/qunit.css">
<link rel="stylesheet" href="../subsuiteRunner.css">
diff --git a/tests/unit/tabs/tabs.html b/tests/unit/tabs/tabs.html
index 688b2642f..f2a672b2e 100644
--- a/tests/unit/tabs/tabs.html
+++ b/tests/unit/tabs/tabs.html
@@ -4,15 +4,21 @@
<meta charset="utf-8">
<title>jQuery UI Tabs Test Suite</title>
- <link rel="stylesheet" href="../../../themes/base/jquery.ui.tabs.css">
-
<script src="../../jquery.js"></script>
<script>
$.uiBackCompat = false;
</script>
- <script src="../../../ui/jquery.ui.core.js"></script>
- <script src="../../../ui/jquery.ui.widget.js"></script>
- <script src="../../../ui/jquery.ui.tabs.js"></script>
+ <script src="../../resource_loader.js"></script>
+ <script>
+ loadResources({
+ css: [ "ui.core", "ui.tabs" ],
+ js: [
+ "ui/jquery.ui.core.js",
+ "ui/jquery.ui.widget.js",
+ "ui/jquery.ui.tabs.js"
+ ]
+ });
+ </script>
<link rel="stylesheet" href="../../../external/qunit.css">
<script src="../../../external/qunit.js"></script>
diff --git a/tests/unit/tabs/tabs_core.js b/tests/unit/tabs/tabs_core.js
index 98cb617ec..e7c1ee576 100644
--- a/tests/unit/tabs/tabs_core.js
+++ b/tests/unit/tabs/tabs_core.js
@@ -48,7 +48,7 @@ test( "aria-controls", function() {
tabs = element.find( ".ui-tabs-nav a" );
tabs.each(function() {
var tab = $( this );
- equal( tab.attr( "href" ).substring( 1 ), tab.attr( "aria-controls" ) );
+ equal( tab.prop( "hash" ).substring( 1 ), tab.attr( "aria-controls" ) );
});
element = $( "#tabs2" ).tabs();
diff --git a/tests/unit/tabs/tabs_deprecated.html b/tests/unit/tabs/tabs_deprecated.html
index 322cec163..92d9be81c 100644
--- a/tests/unit/tabs/tabs_deprecated.html
+++ b/tests/unit/tabs/tabs_deprecated.html
@@ -4,13 +4,19 @@
<meta charset="utf-8">
<title>jQuery UI Tabs Test Suite</title>
- <link rel="stylesheet" href="../../../themes/base/jquery.ui.tabs.css">
-
<script src="../../jquery.js"></script>
<script src="../../../external/jquery.cookie.js"></script>
- <script src="../../../ui/jquery.ui.core.js"></script>
- <script src="../../../ui/jquery.ui.widget.js"></script>
- <script src="../../../ui/jquery.ui.tabs.js"></script>
+ <script src="../../resource_loader.js"></script>
+ <script>
+ loadResources({
+ css: [ "ui.core", "ui.tabs" ],
+ js: [
+ "ui/jquery.ui.core.js",
+ "ui/jquery.ui.widget.js",
+ "ui/jquery.ui.tabs.js"
+ ]
+ });
+ </script>
<link rel="stylesheet" href="../../../external/qunit.css">
<script src="../../../external/qunit.js"></script>
diff --git a/tests/unit/tabs/tabs_events.js b/tests/unit/tabs/tabs_events.js
index 12c9bb87b..f5cde180b 100644
--- a/tests/unit/tabs/tabs_events.js
+++ b/tests/unit/tabs/tabs_events.js
@@ -206,7 +206,8 @@ test( "beforeLoad", function() {
});
element.find( ".ui-tabs-nav a" ).eq( 3 ).click();
tabs_state( element, 0, 0, 0, 1, 0 );
- equals( panel.html(), "<p>testing</p>", "panel html after" );
+ // .toLowerCase() is needed to convert <P> to <p> in old IEs
+ equals( panel.html().toLowerCase(), "<p>testing</p>", "panel html after" );
});
if ( $.uiBackCompat === false ) {
diff --git a/tests/unit/tabs/tabs_methods.js b/tests/unit/tabs/tabs_methods.js
index ec21e2de7..b62f7bb3a 100644
--- a/tests/unit/tabs/tabs_methods.js
+++ b/tests/unit/tabs/tabs_methods.js
@@ -180,7 +180,7 @@ asyncTest( "load", function() {
strictEqual( uiPanel[ 0 ], panel[ 0 ], "panel" );
equals( uiPanel.find( "p" ).length, 1, "panel html" );
tabs_state( element, 1, 0, 0, 0, 0 );
- setTimeout( tabsload1, 1 );
+ setTimeout( tabsload1, 100 );
});
element.tabs( "load", 3 );
tabs_state( element, 1, 0, 0, 0, 0 );
@@ -192,7 +192,7 @@ asyncTest( "load", function() {
});
element.one( "tabsload", function() {
ok( true, "tabsload invoked" );
- setTimeout( tabsload2, 1 );
+ setTimeout( tabsload2, 100 );
});
element.tabs( "option", "active", 3 );
tabs_state( element, 0, 0, 0, 1, 0 );
diff --git a/tests/unit/tooltip/all.html b/tests/unit/tooltip/all.html
index de147a71c..fac3c7070 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.6.2.js"></script>
+ <script src="../../../jquery-1.7.js"></script>
<link rel="stylesheet" href="../../../external/qunit.css">
<link rel="stylesheet" href="../subsuiteRunner.css">
diff --git a/tests/unit/tooltip/tooltip.html b/tests/unit/tooltip/tooltip.html
index 82070fbfd..b5e8558e5 100644
--- a/tests/unit/tooltip/tooltip.html
+++ b/tests/unit/tooltip/tooltip.html
@@ -4,13 +4,19 @@
<meta charset="utf-8">
<title>jQuery UI Tooltip Test Suite</title>
- <link rel="stylesheet" href="../../../themes/base/jquery.ui.tooltip.css">
-
<script src="../../jquery.js"></script>
- <script src="../../../ui/jquery.ui.core.js"></script>
- <script src="../../../ui/jquery.ui.widget.js"></script>
- <script src="../../../ui/jquery.ui.position.js"></script>
- <script src="../../../ui/jquery.ui.tooltip.js"></script>
+ <script src="../../resource_loader.js"></script>
+ <script>
+ loadResources({
+ css: [ "ui.core", "ui.tooltip" ],
+ js: [
+ "ui/jquery.ui.core.js",
+ "ui/jquery.ui.widget.js",
+ "ui/jquery.ui.position.js",
+ "ui/jquery.ui.tooltip.js"
+ ]
+ });
+ </script>
<link rel="stylesheet" href="../../../external/qunit.css">
<script src="../../../external/qunit.js"></script>
diff --git a/tests/unit/tooltip/tooltip_defaults.js b/tests/unit/tooltip/tooltip_defaults.js
index 4b687bdcb..b8b41bf47 100644
--- a/tests/unit/tooltip/tooltip_defaults.js
+++ b/tests/unit/tooltip/tooltip_defaults.js
@@ -7,7 +7,7 @@ commonWidgetTests( "tooltip", {
position: {
my: "left+15 center",
at: "right center",
- collision: "flip fit"
+ collision: "flipfit flipfit"
},
show: true,
tooltipClass: null,
diff --git a/tests/unit/tooltip/tooltip_events.js b/tests/unit/tooltip/tooltip_events.js
index 29220705f..99e1fbd79 100644
--- a/tests/unit/tooltip/tooltip_events.js
+++ b/tests/unit/tooltip/tooltip_events.js
@@ -52,14 +52,14 @@ test( "focus events", function() {
element.trigger( "blur" );
});
-test( "mixed events", function() {
+asyncTest( "mixed events", function() {
expect( 2 );
var element = $( "#tooltipped1" ).tooltip();
element.one( "tooltipopen", function( event ) {
same( event.originalEvent.type, "focusin" );
});
- element[0].focus();
+ element.simulate( "focus" );
element.one( "tooltipopen", function() {
ok( false, "open triggered while already open" );
@@ -72,10 +72,12 @@ test( "mixed events", function() {
element.trigger( "mouseleave" );
element.unbind( "tooltipclose" );
+ // blurring is async in IE
element.one( "tooltipclose", function( event ) {
same( event.originalEvent.type, "blur" );
+ start();
});
- element[0].blur();
+ element.simulate( "blur" );
});
}( jQuery ) );
diff --git a/tests/unit/widget/all.html b/tests/unit/widget/all.html
index 2b14d474d..83df4905c 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.6.2.js"></script>
+ <script src="../../../jquery-1.7.js"></script>
<link rel="stylesheet" href="../../../external/qunit.css">
<link rel="stylesheet" href="../subsuiteRunner.css">
diff --git a/tests/unit/widget/widget.html b/tests/unit/widget/widget.html
index 7ae41f264..6f4caaa6c 100644
--- a/tests/unit/widget/widget.html
+++ b/tests/unit/widget/widget.html
@@ -5,8 +5,15 @@
<title>jQuery UI Widget Test Suite</title>
<script src="../../jquery.js"></script>
- <script src="../../../ui/jquery.ui.core.js"></script>
- <script src="../../../ui/jquery.ui.widget.js"></script>
+ <script src="../../resource_loader.js"></script>
+ <script>
+ loadResources({
+ css: [ "ui.core" ],
+ js: [
+ "ui/jquery.ui.widget.js"
+ ]
+ });
+ </script>
<link rel="stylesheet" href="../../../external/qunit.css">
<script src="../../../external/qunit.js"></script>
diff --git a/tests/unit/widget/widget_core.js b/tests/unit/widget/widget_core.js
index 8cacdd47d..0510da4b4 100644
--- a/tests/unit/widget/widget_core.js
+++ b/tests/unit/widget/widget_core.js
@@ -571,23 +571,23 @@ test( ".widget() - overriden", function() {
test( "._bind() to element (default)", function() {
expect( 12 );
- var self;
+ var that;
$.widget( "ui.testWidget", {
_create: function() {
- self = this;
+ that = this;
this._bind({
keyup: this.keyup,
keydown: "keydown"
});
},
keyup: function( event ) {
- equals( self, this );
- equals( self.element[0], event.currentTarget );
+ equals( that, this );
+ equals( that.element[0], event.currentTarget );
equals( "keyup", event.type );
},
keydown: function( event ) {
- equals( self, this );
- equals( self.element[0], event.currentTarget );
+ equals( that, this );
+ equals( that.element[0], event.currentTarget );
equals( "keydown", event.type );
}
});
@@ -611,23 +611,23 @@ test( "._bind() to element (default)", function() {
test( "._bind() to descendent", function() {
expect( 12 );
- var self;
+ var that;
$.widget( "ui.testWidget", {
_create: function() {
- self = this;
+ that = this;
this._bind( this.element.find( "strong" ), {
keyup: this.keyup,
keydown: "keydown"
});
},
keyup: function( event ) {
- equals( self, this );
- equals( self.element.find( "strong" )[0], event.currentTarget );
+ equals( that, this );
+ equals( that.element.find( "strong" )[0], event.currentTarget );
equals( "keyup", event.type );
},
keydown: function(event) {
- equals( self, this );
- equals( self.element.find( "strong" )[0], event.currentTarget );
+ equals( that, this );
+ equals( that.element.find( "strong" )[0], event.currentTarget );
equals( "keydown", event.type );
}
});
@@ -673,23 +673,31 @@ test( "_bind() with delegate", function() {
this.element = {
bind: function( event, handler ) {
equal( event, "click.testWidget" );
- ok( $.isFunction(handler) );
- },
- delegate: function( selector, event, handler ) {
- equal( selector, "a" );
- equal( event, "click.testWidget" );
- ok( $.isFunction(handler) );
+ ok( $.isFunction(handler) );
},
trigger: $.noop
};
+ this.widget = function() {
+ return {
+ delegate: function( selector, event, handler ) {
+ equal( selector, "a" );
+ equal( event, "click.testWidget" );
+ ok( $.isFunction(handler) );
+ }
+ };
+ };
this._bind({
"click": "handler",
- "click a": "handler",
+ "click a": "handler"
});
- this.element.delegate = function( selector, event, handler ) {
- equal( selector, "form fieldset > input" );
- equal( event, "change.testWidget" );
- ok( $.isFunction(handler) );
+ this.widget = function() {
+ return {
+ delegate: function( selector, event, handler ) {
+ equal( selector, "form fieldset > input" );
+ equal( event, "change.testWidget" );
+ ok( $.isFunction(handler) );
+ }
+ };
};
this._bind({
"change form fieldset > input": "handler"
@@ -979,31 +987,31 @@ test( "._trigger() - instance as element", function() {
$( "#widget" ).testWidget().remove();
});
});
-
+
test( "auto-destroy - .remove() on parent", function() {
shouldDestroy( true, function() {
$( "#widget" ).testWidget().parent().remove();
});
});
-
+
test( "auto-destroy - .remove() on child", function() {
shouldDestroy( false, function() {
$( "#widget" ).testWidget().children().remove();
});
});
-
+
test( "auto-destroy - .empty()", function() {
shouldDestroy( false, function() {
$( "#widget" ).testWidget().empty();
});
});
-
+
test( "auto-destroy - .empty() on parent", function() {
shouldDestroy( true, function() {
$( "#widget" ).testWidget().parent().empty();
});
});
-
+
test( "auto-destroy - .detach()", function() {
shouldDestroy( false, function() {
$( "#widget" ).testWidget().detach();
@@ -1032,4 +1040,30 @@ test( "redefine", function() {
equal( $.ui.testWidget.foo, "bar", "static properties remain" );
});
+asyncTest( "_delay", function() {
+ expect( 6 );
+ var order = 0,
+ that;
+ $.widget( "ui.testWidget", {
+ defaultElement: null,
+ _create: function() {
+ that = this;
+ var timer = this._delay(function() {
+ strictEqual( this, that );
+ equal( order, 1 );
+ start();
+ }, 500);
+ ok( timer !== undefined );
+ timer = this._delay("callback");
+ ok( timer !== undefined );
+ },
+ callback: function() {
+ strictEqual( this, that );
+ equal( order, 0 );
+ order += 1;
+ }
+ });
+ $( "#widget" ).testWidget();
+});
+
}( jQuery ) );
diff --git a/tests/unit/widget/widget_extend.js b/tests/unit/widget/widget_extend.js
index fb78ecfb7..90e686e18 100644
--- a/tests/unit/widget/widget_extend.js
+++ b/tests/unit/widget/widget_extend.js
@@ -6,7 +6,6 @@ test( "$.widget.extend()", function() {
optionsCopy = { xnumber2: 1, xstring2: "x", xxx: "newstring" },
merged = { xnumber1: 5, xnumber2: 1, xstring1: "peter", xstring2: "x", xxx: "newstring" },
deep1 = { foo: { bar: true } },
- deep1copy = { foo: { bar: true } },
deep2 = { foo: { baz: true }, foo2: document },
deep2copy = { foo: { baz: true }, foo2: document },
deepmerged = { foo: { bar: true, baz: true }, foo2: document },
@@ -93,10 +92,10 @@ test( "$.widget.extend()", function() {
deepEqual( defaults, defaultsCopy, "Check if not modified: options1 must not be modified" );
deepEqual( options1, options1Copy, "Check if not modified: options1 must not be modified" );
deepEqual( options2, options2Copy, "Check if not modified: options2 must not be modified" );
-
+
var input = {
key: [ 1, 2, 3 ]
- }
+ };
var output = $.widget.extend( {}, input );
deepEqual( input, output, "don't clone arrays" );
input.key[0] = 10;