Widget: define a null default for the create callback.

This commit is contained in:
Scott González 2011-04-25 14:04:30 -04:00
parent c4c36e557e
commit 325ee6e871
15 changed files with 125 additions and 121 deletions

View File

@ -14,6 +14,7 @@ commonWidgetTests( "accordion", {
// callbacks // callbacks
activate: null, activate: null,
beforeActivate: null beforeActivate: null,
create: null
} }
}); });

View File

@ -22,6 +22,7 @@ commonWidgetTests( "accordion", {
activate: null, activate: null,
beforeActivate: null, beforeActivate: null,
change: null, change: null,
changestart: null changestart: null,
create: null
} }
}); });

View File

@ -15,6 +15,7 @@ commonWidgetTests( "autocomplete", {
// callbacks // callbacks
change: null, change: null,
close: null, close: null,
create: null,
focus: null, focus: null,
open: null, open: null,
response: null, response: null,

View File

@ -1,15 +1,14 @@
/* commonWidgetTests( "button", {
* button_defaults.js defaults: {
*/
var button_defaults = {
disabled: null, disabled: null,
text: true,
label: null,
icons: { icons: {
primary: null, primary: null,
secondary: null secondary: null
} },
}; label: null,
text: true,
commonWidgetTests('button', { defaults: button_defaults }); // callbacks
create: null
}
});

View File

@ -1,8 +1,5 @@
/* commonWidgetTests( "dialog", {
* dialog_defaults.js defaults: {
*/
var dialog_defaults = {
autoOpen: true, autoOpen: true,
buttons: {}, buttons: {},
closeOnEscape: true, closeOnEscape: true,
@ -29,7 +26,9 @@ var dialog_defaults = {
stack: true, stack: true,
title: '', title: '',
width: 300, width: 300,
zIndex: 1000 zIndex: 1000,
};
commonWidgetTests('dialog', { defaults: dialog_defaults }); // callbacks
create: null
}
});

View File

@ -180,7 +180,7 @@ test("height", function() {
expect(3); expect(3);
el = $('<div></div>').dialog(); el = $('<div></div>').dialog();
equals(dlg().height(), dialog_defaults.minHeight, "default height"); equals(dlg().height(), 150, "default height");
el.remove(); el.remove();
el = $('<div></div>').dialog({ height: 237 }); el = $('<div></div>').dialog({ height: 237 });
@ -431,7 +431,7 @@ test("width", function() {
expect(3); expect(3);
el = $('<div></div>').dialog(); el = $('<div></div>').dialog();
equals(dlg().width(), dialog_defaults.width, "default width"); equals(dlg().width(), 300, "default width");
el.remove(); el.remove();
el = $('<div></div>').dialog({width: 437 }); el = $('<div></div>').dialog({width: 437 });

View File

@ -1,13 +1,12 @@
/* commonWidgetTests( "menu", {
* menu_defaults.js defaults: {
*/
var menu_defaults = {
disabled: false, disabled: false,
position: { position: {
my: "left top", my: "left top",
at: "right top" at: "right top"
} },
};
commonWidgetTests('menu', { defaults: menu_defaults }); // callbacks
create: null
}
});

View File

@ -1,11 +1,10 @@
/* commonWidgetTests( "progressbar", {
* progressbar_defaults.js defaults: {
*/
var progressbar_defaults = {
disabled: false, disabled: false,
value: 0, value: 0,
max: 100 max: 100,
};
commonWidgetTests('progressbar', { defaults: progressbar_defaults }); //callbacks
create: null
}
});

View File

@ -1,8 +1,5 @@
/* commonWidgetTests( "slider", {
* slider_defaults.js defaults: {
*/
var slider_defaults = {
animate: false, animate: false,
cancel: function() {}, cancel: function() {},
delay: 0, delay: 0,
@ -14,7 +11,9 @@ var slider_defaults = {
range: false, range: false,
step: 1, step: 1,
value: 0, value: 0,
values: null values: null,
};
commonWidgetTests('slider', { defaults: slider_defaults }); // callbacks
create: null
}
});

View File

@ -1,8 +1,5 @@
/* commonWidgetTests( "spinner", {
* spinner_defaults.js defaults: {
*/
var spinner_defaults = {
disabled: false, disabled: false,
incremental: true, incremental: true,
max: null, max: null,
@ -10,7 +7,9 @@ var spinner_defaults = {
numberformat: null, numberformat: null,
page: 10, page: 10,
step: null, step: null,
value: null value: null,
};
commonWidgetTests('spinner', { defaults: spinner_defaults }); // callbacks
create: null
}
});

View File

@ -10,6 +10,7 @@ commonWidgetTests( "tabs", {
activate: null, activate: null,
beforeActivate: null, beforeActivate: null,
beforeLoad: null, beforeLoad: null,
create: null,
load: null load: null
} }
}); });

View File

@ -18,6 +18,7 @@ commonWidgetTests( "tabs", {
add: null, add: null,
beforeActivate: null, beforeActivate: null,
beforeLoad: null, beforeLoad: null,
create: null,
disable: null, disable: null,
enable: null, enable: null,
load: null, load: null,

View File

@ -1,8 +1,5 @@
/* commonWidgetTests( "tooltip", {
* tooltip_defaults.js defaults: {
*/
var tooltip_defaults = {
disabled: false, disabled: false,
items: "[title]", items: "[title]",
content: $.ui.tooltip.prototype.options.content, content: $.ui.tooltip.prototype.options.content,
@ -10,7 +7,9 @@ var tooltip_defaults = {
my: "left center", my: "left center",
at: "right center", at: "right center",
offset: "15 0" offset: "15 0"
} },
};
commonWidgetTests('tooltip', { defaults: tooltip_defaults }); // callbacks
create: null
}
});

View File

@ -202,6 +202,7 @@ test( "merge multiple option arguments", function() {
$.widget( "ui.testWidget", { $.widget( "ui.testWidget", {
_create: function() { _create: function() {
same( this.options, { same( this.options, {
create: null,
disabled: false, disabled: false,
option1: "value1", option1: "value1",
option2: "value2", option2: "value2",
@ -249,6 +250,7 @@ test( "._getCreateOptions()", function() {
}, },
_create: function() { _create: function() {
same( this.options, { same( this.options, {
create: null,
disabled: false, disabled: false,
option1: "override1", option1: "override1",
option2: "value2", option2: "value2",
@ -418,6 +420,7 @@ test( ".option() - getter", function() {
var options = div.testWidget( "option" ); var options = div.testWidget( "option" );
same( options, { same( options, {
create: null,
disabled: false, disabled: false,
foo: "bar", foo: "bar",
baz: 5, baz: 5,

View File

@ -155,7 +155,10 @@ $.Widget.prototype = {
widgetEventPrefix: "", widgetEventPrefix: "",
defaultElement: "<div>", defaultElement: "<div>",
options: { options: {
disabled: false disabled: false,
// callbacks
create: null
}, },
_createWidget: function( options, element ) { _createWidget: function( options, element ) {
element = $( element || this.defaultElement || this )[ 0 ]; element = $( element || this.defaultElement || this )[ 0 ];