Skip to content
Permalink
Browse files

dialog: corrected typo in ui.position property for drag events. Updat…

…ed unit tests tracking fix of #5291
  • Loading branch information...
rdworth committed Mar 11, 2010
1 parent 89f1042 commit 789830343771ee3bb3b9dcfb030d99e4aeefafbc
Showing with 43 additions and 19 deletions.
  1. +42 −18 tests/unit/dialog/dialog_events.js
  2. +1 −1 ui/jquery.ui.dialog.js
@@ -38,27 +38,29 @@ test("open", function() {
});

test("dragStart", function() {
expect(7);
expect(9);

el = $('<div></div>').dialog({
dragStart: function(ev, ui) {
ok(true, 'dragging fires dragStart callback');
equals(this, el[0], "context of callback");
equals(ev.type, 'dialogdragstart', 'event type in callback');
same(ui, {}, 'ui hash in callback');
ok(ui.position !== undefined, "ui.position in callback");
ok(ui.offset !== undefined, "ui.offset in callback");
}
}).bind('dialogdragstart', function(ev, ui) {
ok(true, 'dragging fires dialogdragstart event');
equals(this, el[0], 'context of event');
same(ui, {}, 'ui hash in event');
ok(ui.position !== undefined, "ui.position in callback");
ok(ui.offset !== undefined, "ui.offset in callback");
});
var handle = $(".ui-dialog-titlebar", dlg());
drag(handle, 50, 50);
el.remove();
});

test("drag", function() {
expect(7);
expect(9);
var hasDragged = false;

el = $('<div></div>').dialog({
@@ -67,63 +69,73 @@ test("drag", function() {
ok(true, 'dragging fires drag callback');
equals(this, el[0], "context of callback");
equals(ev.type, 'dialogdrag', 'event type in callback');
same(ui, {}, 'ui hash in callback');
ok(ui.position !== undefined, "ui.position in callback");
ok(ui.offset !== undefined, "ui.offset in callback");

hasDragged = true;
}
}
}).one('dialogdrag', function(ev, ui) {
ok(true, 'dragging fires dialogdrag event');
equals(this, el[0], 'context of event');
same(ui, {}, 'ui hash in event');
ok(ui.position !== undefined, "ui.position in callback");
ok(ui.offset !== undefined, "ui.offset in callback");
});
var handle = $(".ui-dialog-titlebar", dlg());
drag(handle, 50, 50);
el.remove();
});

test("dragStop", function() {
expect(7);
expect(9);

el = $('<div></div>').dialog({
dragStop: function(ev, ui) {
ok(true, 'dragging fires dragStop callback');
equals(this, el[0], "context of callback");
equals(ev.type, 'dialogdragstop', 'event type in callback');
same(ui, {}, 'ui hash in callback');
ok(ui.position !== undefined, "ui.position in callback");
ok(ui.offset !== undefined, "ui.offset in callback");
}
}).bind('dialogdragstop', function(ev, ui) {
ok(true, 'dragging fires dialogdragstop event');
equals(this, el[0], 'context of event');
same(ui, {}, 'ui hash in event');
ok(ui.position !== undefined, "ui.position in callback");
ok(ui.offset !== undefined, "ui.offset in callback");
});
var handle = $(".ui-dialog-titlebar", dlg());
drag(handle, 50, 50);
el.remove();
});

test("resizeStart", function() {
expect(7);
expect(13);

el = $('<div></div>').dialog({
resizeStart: function(ev, ui) {
ok(true, 'resizing fires resizeStart callback');
equals(this, el[0], "context of callback");
equals(ev.type, 'dialogresizestart', 'event type in callback');
same(ui, {}, 'ui hash in callback');
ok(ui.originalPosition !== undefined, "ui.originalPosition in callback");
ok(ui.originalSize !== undefined, "ui.originalSize in callback");
ok(ui.position !== undefined, "ui.position in callback");
ok(ui.size !== undefined, "ui.size in callback");
}
}).bind('dialogresizestart', function(ev, ui) {
ok(true, 'resizing fires dialogresizestart event');
equals(this, el[0], 'context of event');
same(ui, {}, 'ui hash in event');
ok(ui.originalPosition !== undefined, "ui.originalPosition in callback");
ok(ui.originalSize !== undefined, "ui.originalSize in callback");
ok(ui.position !== undefined, "ui.position in callback");
ok(ui.size !== undefined, "ui.size in callback");
});
var handle = $(".ui-resizable-se", dlg());
drag(handle, 50, 50);
el.remove();
});

test("resize", function() {
expect(7);
expect(13);
var hasResized = false;

el = $('<div></div>').dialog({
@@ -132,35 +144,47 @@ test("resize", function() {
ok(true, 'resizing fires resize callback');
equals(this, el[0], "context of callback");
equals(ev.type, 'dialogresize', 'event type in callback');
same(ui, {}, 'ui hash in callback');
ok(ui.originalPosition !== undefined, "ui.originalPosition in callback");
ok(ui.originalSize !== undefined, "ui.originalSize in callback");
ok(ui.position !== undefined, "ui.position in callback");
ok(ui.size !== undefined, "ui.size in callback");

hasResized = true;
}
}
}).one('dialogresize', function(ev, ui) {
ok(true, 'resizing fires dialogresize event');
equals(this, el[0], 'context of event');
same(ui, {}, 'ui hash in event');
ok(ui.originalPosition !== undefined, "ui.originalPosition in callback");
ok(ui.originalSize !== undefined, "ui.originalSize in callback");
ok(ui.position !== undefined, "ui.position in callback");
ok(ui.size !== undefined, "ui.size in callback");
});
var handle = $(".ui-resizable-se", dlg());
drag(handle, 50, 50);
el.remove();
});

test("resizeStop", function() {
expect(7);
expect(13);

el = $('<div></div>').dialog({
resizeStop: function(ev, ui) {
ok(true, 'resizing fires resizeStop callback');
equals(this, el[0], "context of callback");
equals(ev.type, 'dialogresizestop', 'event type in callback');
same(ui, {}, 'ui hash in callback');
ok(ui.originalPosition !== undefined, "ui.originalPosition in callback");
ok(ui.originalSize !== undefined, "ui.originalSize in callback");
ok(ui.position !== undefined, "ui.position in callback");
ok(ui.size !== undefined, "ui.size in callback");
}
}).bind('dialogresizestop', function(ev, ui) {
ok(true, 'resizing fires dialogresizestop event');
equals(this, el[0], 'context of event');
same(ui, {}, 'ui hash in event');
ok(ui.originalPosition !== undefined, "ui.originalPosition in callback");
ok(ui.originalSize !== undefined, "ui.originalSize in callback");
ok(ui.position !== undefined, "ui.position in callback");
ok(ui.size !== undefined, "ui.size in callback");
});
var handle = $(".ui-resizable-se", dlg());
drag(handle, 50, 50);
@@ -329,7 +329,7 @@ $.widget("ui.dialog", {

function filteredUi(ui) {
return {
positon: ui.position,
position: ui.position,
offset: ui.offset
};
}

0 comments on commit 7898303

Please sign in to comment.
You can’t perform that action at this time.