From 789830343771ee3bb3b9dcfb030d99e4aeefafbc Mon Sep 17 00:00:00 2001 From: Richard Worth Date: Thu, 11 Mar 2010 20:48:21 +0000 Subject: [PATCH] dialog: corrected typo in ui.position property for drag events. Updated unit tests tracking fix of #5291 --- tests/unit/dialog/dialog_events.js | 60 +++++++++++++++++++++--------- ui/jquery.ui.dialog.js | 2 +- 2 files changed, 43 insertions(+), 19 deletions(-) diff --git a/tests/unit/dialog/dialog_events.js b/tests/unit/dialog/dialog_events.js index a0ff2abce..e2b7bd9ee 100644 --- a/tests/unit/dialog/dialog_events.js +++ b/tests/unit/dialog/dialog_events.js @@ -38,19 +38,21 @@ test("open", function() { }); test("dragStart", function() { - expect(7); + expect(9); el = $('
').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); @@ -58,7 +60,7 @@ test("dragStart", function() { }); test("drag", function() { - expect(7); + expect(9); var hasDragged = false; el = $('
').dialog({ @@ -67,7 +69,8 @@ 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; } @@ -75,7 +78,8 @@ test("drag", function() { }).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); @@ -83,19 +87,21 @@ test("drag", function() { }); test("dragStop", function() { - expect(7); + expect(9); el = $('
').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); @@ -103,19 +109,25 @@ test("dragStop", function() { }); test("resizeStart", function() { - expect(7); + expect(13); el = $('
').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); @@ -123,7 +135,7 @@ test("resizeStart", function() { }); test("resize", function() { - expect(7); + expect(13); var hasResized = false; el = $('
').dialog({ @@ -132,7 +144,10 @@ 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; } @@ -140,7 +155,10 @@ test("resize", function() { }).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); @@ -148,19 +166,25 @@ test("resize", function() { }); test("resizeStop", function() { - expect(7); + expect(13); el = $('
').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); diff --git a/ui/jquery.ui.dialog.js b/ui/jquery.ui.dialog.js index 73cbbc89c..7263d2cd5 100644 --- a/ui/jquery.ui.dialog.js +++ b/ui/jquery.ui.dialog.js @@ -329,7 +329,7 @@ $.widget("ui.dialog", { function filteredUi(ui) { return { - positon: ui.position, + position: ui.position, offset: ui.offset }; } -- 2.39.5