module("dialog: Callbacks");
test("open", function() {
- expect(4);
+ expect(6);
+
el = $("<div/>");
el.dialog({
open: function(ev, ui) {
}
});
el.remove();
+
el = $("<div/>");
el.dialog({
autoOpen: false,
});
el.dialog("open");
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() {
- expect(1);
+ expect(2);
+
el = $("<div/>");
el.dialog({
dragStart: function(ev, ui) {
+ ok(true, 'dragging fires dragStart callback');
equals(this, el[0], "context of callback");
}
});
test("drag", function() {
var fired = false;
+
el = $("<div/>");
el.dialog({
drag: function(ev, ui) {
});
var handle = $(".ui-dialog-titlebar", dlg());
drag(handle, 50, 50);
- ok(fired, "resize fired");
+ ok(fired, "drag fired");
el.remove();
});
test("dragStop", function() {
- expect(1);
+ expect(2);
+
el = $("<div/>");
el.dialog({
dragStop: function(ev, ui) {
+ ok(true, 'dragging fires dragStop callback');
equals(this, el[0], "context of callback");
}
});
});
test("resizeStart", function() {
- expect(1);
+ expect(2);
+
el = $("<div/>");
el.dialog({
resizeStart: function(ev, ui) {
+ ok(true, 'resizing fires resizeStart callback');
equals(this, el[0], "context of callback");
}
});
test("resize", function() {
var fired = false;
+
el = $("<div/>");
el.dialog({
resize: function(ev, ui) {
});
test("resizeStop", function() {
- expect(1);
+ expect(2);
+
el = $("<div/>");
el.dialog({
resizeStop: function(ev, ui) {
+ ok(true, 'resizing fires resizeStop callback');
equals(this, el[0], "context of callback");
}
});
});
test("close", function() {
- expect(2);
+ expect(4);
+
el = $('<div/>').dialog({
close: function(ev, ui) {
ok(true, '.dialog("close") fires close callback');
});
el.dialog("close");
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() {