mirror of
https://github.com/jquery/jquery-ui.git
synced 2025-01-07 20:34:24 +00:00
Dialog: Added more tests.
This commit is contained in:
parent
e1f4ea3ed3
commit
f69b4fe35e
@ -531,7 +531,8 @@ test("isOpen", function() {
|
|||||||
module("dialog: Callbacks");
|
module("dialog: Callbacks");
|
||||||
|
|
||||||
test("open", function() {
|
test("open", function() {
|
||||||
expect(4);
|
expect(6);
|
||||||
|
|
||||||
el = $("<div/>");
|
el = $("<div/>");
|
||||||
el.dialog({
|
el.dialog({
|
||||||
open: function(ev, ui) {
|
open: function(ev, ui) {
|
||||||
@ -540,6 +541,7 @@ test("open", function() {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
el.remove();
|
el.remove();
|
||||||
|
|
||||||
el = $("<div/>");
|
el = $("<div/>");
|
||||||
el.dialog({
|
el.dialog({
|
||||||
autoOpen: false,
|
autoOpen: false,
|
||||||
@ -550,13 +552,25 @@ test("open", function() {
|
|||||||
});
|
});
|
||||||
el.dialog("open");
|
el.dialog("open");
|
||||||
el.remove();
|
el.remove();
|
||||||
|
|
||||||
|
el = $('<div/>').dialog({
|
||||||
|
autoOpen: false
|
||||||
|
});
|
||||||
|
el.bind('dialogopen', function(ev, ui) {
|
||||||
|
ok(true, 'dialog("open") fires open event');
|
||||||
|
equals(this, el[0], 'context of event');
|
||||||
|
});
|
||||||
|
el.dialog('open');
|
||||||
|
el.remove();
|
||||||
});
|
});
|
||||||
|
|
||||||
test("dragStart", function() {
|
test("dragStart", function() {
|
||||||
expect(1);
|
expect(2);
|
||||||
|
|
||||||
el = $("<div/>");
|
el = $("<div/>");
|
||||||
el.dialog({
|
el.dialog({
|
||||||
dragStart: function(ev, ui) {
|
dragStart: function(ev, ui) {
|
||||||
|
ok(true, 'dragging fires dragStart callback');
|
||||||
equals(this, el[0], "context of callback");
|
equals(this, el[0], "context of callback");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -567,6 +581,7 @@ test("dragStart", function() {
|
|||||||
|
|
||||||
test("drag", function() {
|
test("drag", function() {
|
||||||
var fired = false;
|
var fired = false;
|
||||||
|
|
||||||
el = $("<div/>");
|
el = $("<div/>");
|
||||||
el.dialog({
|
el.dialog({
|
||||||
drag: function(ev, ui) {
|
drag: function(ev, ui) {
|
||||||
@ -576,15 +591,17 @@ test("drag", function() {
|
|||||||
});
|
});
|
||||||
var handle = $(".ui-dialog-titlebar", dlg());
|
var handle = $(".ui-dialog-titlebar", dlg());
|
||||||
drag(handle, 50, 50);
|
drag(handle, 50, 50);
|
||||||
ok(fired, "resize fired");
|
ok(fired, "drag fired");
|
||||||
el.remove();
|
el.remove();
|
||||||
});
|
});
|
||||||
|
|
||||||
test("dragStop", function() {
|
test("dragStop", function() {
|
||||||
expect(1);
|
expect(2);
|
||||||
|
|
||||||
el = $("<div/>");
|
el = $("<div/>");
|
||||||
el.dialog({
|
el.dialog({
|
||||||
dragStop: function(ev, ui) {
|
dragStop: function(ev, ui) {
|
||||||
|
ok(true, 'dragging fires dragStop callback');
|
||||||
equals(this, el[0], "context of callback");
|
equals(this, el[0], "context of callback");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -594,10 +611,12 @@ test("dragStop", function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
test("resizeStart", function() {
|
test("resizeStart", function() {
|
||||||
expect(1);
|
expect(2);
|
||||||
|
|
||||||
el = $("<div/>");
|
el = $("<div/>");
|
||||||
el.dialog({
|
el.dialog({
|
||||||
resizeStart: function(ev, ui) {
|
resizeStart: function(ev, ui) {
|
||||||
|
ok(true, 'resizing fires resizeStart callback');
|
||||||
equals(this, el[0], "context of callback");
|
equals(this, el[0], "context of callback");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -608,6 +627,7 @@ test("resizeStart", function() {
|
|||||||
|
|
||||||
test("resize", function() {
|
test("resize", function() {
|
||||||
var fired = false;
|
var fired = false;
|
||||||
|
|
||||||
el = $("<div/>");
|
el = $("<div/>");
|
||||||
el.dialog({
|
el.dialog({
|
||||||
resize: function(ev, ui) {
|
resize: function(ev, ui) {
|
||||||
@ -622,10 +642,12 @@ test("resize", function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
test("resizeStop", function() {
|
test("resizeStop", function() {
|
||||||
expect(1);
|
expect(2);
|
||||||
|
|
||||||
el = $("<div/>");
|
el = $("<div/>");
|
||||||
el.dialog({
|
el.dialog({
|
||||||
resizeStop: function(ev, ui) {
|
resizeStop: function(ev, ui) {
|
||||||
|
ok(true, 'resizing fires resizeStop callback');
|
||||||
equals(this, el[0], "context of callback");
|
equals(this, el[0], "context of callback");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -635,7 +657,8 @@ test("resizeStop", function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
test("close", function() {
|
test("close", function() {
|
||||||
expect(2);
|
expect(4);
|
||||||
|
|
||||||
el = $('<div/>').dialog({
|
el = $('<div/>').dialog({
|
||||||
close: function(ev, ui) {
|
close: function(ev, ui) {
|
||||||
ok(true, '.dialog("close") fires close callback');
|
ok(true, '.dialog("close") fires close callback');
|
||||||
@ -644,6 +667,13 @@ test("close", function() {
|
|||||||
});
|
});
|
||||||
el.dialog("close");
|
el.dialog("close");
|
||||||
el.remove();
|
el.remove();
|
||||||
|
|
||||||
|
el = $('<div/>').dialog().bind('dialogclose', function(ev, ui) {
|
||||||
|
ok(true, '.dialog("close") firse dialogclose event');
|
||||||
|
equals(this, el[0], 'context of event');
|
||||||
|
});
|
||||||
|
el.dialog('close');
|
||||||
|
el.remove();
|
||||||
});
|
});
|
||||||
|
|
||||||
test("beforeclose", function() {
|
test("beforeclose", function() {
|
||||||
|
Loading…
Reference in New Issue
Block a user