aboutsummaryrefslogtreecommitdiffstats
path: root/tests/unit/dialog
diff options
context:
space:
mode:
authorAlexander Schmitz <arschmitz@gmail.com>2015-05-13 21:57:04 -0400
committerAlexander Schmitz <arschmitz@gmail.com>2015-05-20 14:27:55 -0400
commitbe0a176b1f399e856654b2e71a1a9df28501a646 (patch)
treef9500a587b21cee75b23ec23d81b1e1d6a7ebb18 /tests/unit/dialog
parent183422bd9f9a1431e51b427c704c6bcd0583bea6 (diff)
downloadjquery-ui-be0a176b1f399e856654b2e71a1a9df28501a646.tar.gz
jquery-ui-be0a176b1f399e856654b2e71a1a9df28501a646.zip
Dialog: Remove core event/alias and deprecated module dependencies
Diffstat (limited to 'tests/unit/dialog')
-rw-r--r--tests/unit/dialog/core.js18
-rw-r--r--tests/unit/dialog/events.js18
-rw-r--r--tests/unit/dialog/methods.js10
-rw-r--r--tests/unit/dialog/options.js2
4 files changed, 24 insertions, 24 deletions
diff --git a/tests/unit/dialog/core.js b/tests/unit/dialog/core.js
index cb086ce8d..770d9f543 100644
--- a/tests/unit/dialog/core.js
+++ b/tests/unit/dialog/core.js
@@ -103,7 +103,7 @@ asyncTest( "focus tabbable", function() {
// Support: IE8
// For some reason the focus doesn't get set properly if we don't
// focus the body first.
- $( "body" ).focus();
+ $( "body" ).trigger( "focus" );
element = $( markup ).dialog( options );
setTimeout(function() {
@@ -116,7 +116,7 @@ asyncTest( "focus tabbable", function() {
function step1() {
checkFocus( "<div><input><input></div>", options, function( done ) {
- var input = element.find( "input:last" ).focus().blur();
+ var input = element.find( "input:last" ).trigger( "focus" ).trigger( "blur" );
element.dialog( "instance" )._focusTabbable();
setTimeout(function() {
equal( document.activeElement, input[ 0 ],
@@ -177,9 +177,9 @@ asyncTest( "focus tabbable", function() {
{
open: function() {
var inputs = $( this ).find( "input" );
- inputs.last().keydown(function( event ) {
+ inputs.last().on( "keydown",function( event ) {
event.preventDefault();
- inputs.first().focus();
+ inputs.first().trigger( "focus" );
});
}
},
@@ -253,7 +253,7 @@ asyncTest( "#9048: multiple modal dialogs opened and closed in different order",
$( "#dialog1" ).dialog( "close" );
setTimeout(function() {
$( "#dialog2" ).dialog( "close" );
- $( "#favorite-animal" ).focus();
+ $( "#favorite-animal" ).trigger( "focus" );
ok( true, "event handlers cleaned up (no errors thrown)" );
start();
});
@@ -277,20 +277,20 @@ asyncTest( "interaction between overlay and other dialogs", function() {
// Support: IE8
// For some reason the focus doesn't get set properly if we don't
// focus the body first.
- $( "body" ).focus();
+ $( "body" ).trigger( "focus" );
// Wait for the modal to init
setTimeout(function() {
second.testWidget( "open" );
// Simulate user tabbing from address bar to an element outside the dialog
- $( "#favorite-animal" ).focus();
+ $( "#favorite-animal" ).trigger( "focus" );
setTimeout(function() {
equal( document.activeElement, secondInput[ 0 ] );
// Last active dialog must receive focus
- firstInput.focus();
- $( "#favorite-animal" ).focus();
+ firstInput.trigger( "focus" );
+ $( "#favorite-animal" ).trigger( "focus" );
setTimeout(function() {
equal( document.activeElement, firstInput[ 0 ] );
diff --git a/tests/unit/dialog/events.js b/tests/unit/dialog/events.js
index 5834b3481..0e48b7afa 100644
--- a/tests/unit/dialog/events.js
+++ b/tests/unit/dialog/events.js
@@ -30,7 +30,7 @@ test("open", function() {
equal(ev.type, "dialogopen", "event type in callback");
deepEqual(ui, {}, "ui hash in callback");
}
- }).bind("dialogopen", function(ev, ui) {
+ }).on("dialogopen", function(ev, ui) {
ok(element.dialog( "instance" )._isOpen, "interal _isOpen flag is set");
ok(true, "dialog('open') fires open event");
equal(this, element[0], "context of event");
@@ -70,7 +70,7 @@ test( "focus", function() {
other.dialog( "moveToTop" );
element.dialog( "moveToTop" );
- element.bind( "dialogfocus", function() {
+ element.on( "dialogfocus", function() {
ok( true, "when mousedown anywhere on the dialog and it wasn't on top" );
});
other.dialog( "moveToTop" );
@@ -96,7 +96,7 @@ test("dragStart", function() {
ok(ui.position !== undefined, "ui.position in callback");
ok(ui.offset !== undefined, "ui.offset in callback");
}
- }).bind("dialogdragstart", function(ev, ui) {
+ }).on("dialogdragstart", function(ev, ui) {
ok(true, "dragging fires dialogdragstart event");
equal(this, element[0], "context of event");
ok(ui.position !== undefined, "ui.position in callback");
@@ -148,7 +148,7 @@ test("dragStop", function() {
ok(ui.position !== undefined, "ui.position in callback");
ok(ui.offset !== undefined, "ui.offset in callback");
}
- }).bind("dialogdragstop", function(ev, ui) {
+ }).on("dialogdragstop", function(ev, ui) {
ok(true, "dragging fires dialogdragstop event");
equal(this, element[0], "context of event");
ok(ui.position !== undefined, "ui.position in callback");
@@ -174,7 +174,7 @@ test("resizeStart", function() {
ok(ui.position !== undefined, "ui.position in callback");
ok(ui.size !== undefined, "ui.size in callback");
}
- }).bind("dialogresizestart", function(ev, ui) {
+ }).on("dialogresizestart", function(ev, ui) {
ok(true, "resizing fires dialogresizestart event");
equal(this, element[0], "context of event");
ok(ui.originalPosition !== undefined, "ui.originalPosition in callback");
@@ -234,7 +234,7 @@ test("resizeStop", function() {
ok(ui.position !== undefined, "ui.position in callback");
ok(ui.size !== undefined, "ui.size in callback");
}
- }).bind("dialogresizestop", function(ev, ui) {
+ }).on("dialogresizestop", function(ev, ui) {
ok(true, "resizing fires dialogresizestop event");
equal(this, element[0], "context of event");
ok(ui.originalPosition !== undefined, "ui.originalPosition in callback");
@@ -258,7 +258,7 @@ asyncTest("close", function() {
equal(ev.type, "dialogclose", "event type in callback");
deepEqual(ui, {}, "ui hash in callback");
}
- }).bind("dialogclose", function(ev, ui) {
+ }).on("dialogclose", function(ev, ui) {
ok(true, ".dialog('close') fires dialogclose event");
equal(this, element[0], "context of event");
deepEqual(ui, {}, "ui hash in event");
@@ -276,7 +276,7 @@ asyncTest("close", function() {
deepEqual(ui, {}, "ui hash in callback");
start();
}
- }).bind("dialogclose", function(ev, ui) {
+ }).on("dialogclose", function(ev, ui) {
ok(true, ".dialog('close') fires dialogclose event");
equal(this, element[0], "context of event");
deepEqual(ui, {}, "ui hash in event");
@@ -314,7 +314,7 @@ test("beforeClose", function() {
ok( element.dialog("widget").is(":visible"), "beforeClose callback should prevent dialog from closing");
element.remove();
- element = $("<div></div>").dialog().bind("dialogbeforeclose", function(ev, ui) {
+ element = $("<div></div>").dialog().on("dialogbeforeclose", function(ev, ui) {
ok(true, ".dialog('close') triggers dialogbeforeclose event");
equal(this, element[0], "context of event");
deepEqual(ui, {}, "ui hash in event");
diff --git a/tests/unit/dialog/methods.js b/tests/unit/dialog/methods.js
index 10b0fd7bb..cee0cd3a7 100644
--- a/tests/unit/dialog/methods.js
+++ b/tests/unit/dialog/methods.js
@@ -84,7 +84,7 @@ asyncTest("#9000: Dialog leaves broken event handler after close/destroy in cert
expect( 1 );
$( "#dialog1" ).dialog({ modal:true }).dialog( "close" ).dialog( "destroy" );
setTimeout(function() {
- $( "#favorite-animal" ).focus();
+ $( "#favorite-animal" ).trigger( "focus" );
ok( true, "close and destroy modal dialog before its really opened" );
start();
});
@@ -223,23 +223,23 @@ asyncTest( "#8958: dialog can be opened while opening", function() {
// Support: IE8
// For some reason the #favorite-color input doesn't get focus if we don't
// focus the body first, causing the test to hang.
- $( "body" ).focus();
+ $( "body" ).trigger( "focus" );
$( "#favorite-animal" )
// We focus the input to start the test. Once it receives focus, the
// dialog will open. Opening the dialog, will cause an element inside
// the dialog to gain focus, thus blurring the input.
- .bind( "focus", function() {
+ .on( "focus", function() {
element.dialog( "open" );
})
// When the input blurs, the dialog is in the process of opening. We
// try to open the dialog again, to make sure that dialogs properly
// handle a call to the open() method during the process of the dialog
// being opened.
- .bind( "blur", function() {
+ .on( "blur", function() {
element.dialog( "open" );
})
- .focus();
+ .trigger( "focus" );
});
test("#5531: dialog width should be at least minWidth on creation", function () {
diff --git a/tests/unit/dialog/options.js b/tests/unit/dialog/options.js
index c33a97c01..6de336fd6 100644
--- a/tests/unit/dialog/options.js
+++ b/tests/unit/dialog/options.js
@@ -171,7 +171,7 @@ test("buttons - advanced", function( assert ) {
assert.hasClasses( buttons, "additional-class" );
deepEqual( buttons.button("option", "icons"), { primary: "ui-icon-cancel", secondary: null } );
equal( buttons.button( "option", "text" ), false );
- buttons.click();
+ buttons.trigger( "click" );
element.remove();
});