aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorScott González <scott.gonzalez@gmail.com>2011-04-25 14:04:30 -0400
committerScott González <scott.gonzalez@gmail.com>2011-04-25 14:04:30 -0400
commit325ee6e87133dd2a507c820dd3c356e3b897a3ec (patch)
treec13ef9ce107caf181f300cb0ab2a6d5214aada87
parentc4c36e557ef2b3450bc365708064f7314bc6fdc4 (diff)
downloadjquery-ui-325ee6e87133dd2a507c820dd3c356e3b897a3ec.tar.gz
jquery-ui-325ee6e87133dd2a507c820dd3c356e3b897a3ec.zip
Widget: define a null default for the create callback.
-rw-r--r--tests/unit/accordion/accordion_defaults.js3
-rw-r--r--tests/unit/accordion/accordion_defaults_deprecated.js3
-rw-r--r--tests/unit/autocomplete/autocomplete_defaults.js1
-rw-r--r--tests/unit/button/button_defaults.js25
-rw-r--r--tests/unit/dialog/dialog_defaults.js67
-rw-r--r--tests/unit/dialog/dialog_options.js4
-rw-r--r--tests/unit/menu/menu_defaults.js21
-rw-r--r--tests/unit/progressbar/progressbar_defaults.js19
-rw-r--r--tests/unit/slider/slider_defaults.js37
-rw-r--r--tests/unit/spinner/spinner_defaults.js29
-rw-r--r--tests/unit/tabs/tabs_defaults.js1
-rw-r--r--tests/unit/tabs/tabs_defaults_deprecated.js1
-rw-r--r--tests/unit/tooltip/tooltip_defaults.js27
-rw-r--r--tests/unit/widget/widget_core.js3
-rw-r--r--ui/jquery.ui.widget.js5
15 files changed, 125 insertions, 121 deletions
diff --git a/tests/unit/accordion/accordion_defaults.js b/tests/unit/accordion/accordion_defaults.js
index 847a394e2..9aa58e650 100644
--- a/tests/unit/accordion/accordion_defaults.js
+++ b/tests/unit/accordion/accordion_defaults.js
@@ -14,6 +14,7 @@ commonWidgetTests( "accordion", {
// callbacks
activate: null,
- beforeActivate: null
+ beforeActivate: null,
+ create: null
}
});
diff --git a/tests/unit/accordion/accordion_defaults_deprecated.js b/tests/unit/accordion/accordion_defaults_deprecated.js
index bdc059d10..3f45a1f10 100644
--- a/tests/unit/accordion/accordion_defaults_deprecated.js
+++ b/tests/unit/accordion/accordion_defaults_deprecated.js
@@ -22,6 +22,7 @@ commonWidgetTests( "accordion", {
activate: null,
beforeActivate: null,
change: null,
- changestart: null
+ changestart: null,
+ create: null
}
});
diff --git a/tests/unit/autocomplete/autocomplete_defaults.js b/tests/unit/autocomplete/autocomplete_defaults.js
index 05897b848..ac83eaea4 100644
--- a/tests/unit/autocomplete/autocomplete_defaults.js
+++ b/tests/unit/autocomplete/autocomplete_defaults.js
@@ -15,6 +15,7 @@ commonWidgetTests( "autocomplete", {
// callbacks
change: null,
close: null,
+ create: null,
focus: null,
open: null,
response: null,
diff --git a/tests/unit/button/button_defaults.js b/tests/unit/button/button_defaults.js
index b81fa7cbb..96c7e5bfa 100644
--- a/tests/unit/button/button_defaults.js
+++ b/tests/unit/button/button_defaults.js
@@ -1,15 +1,14 @@
-/*
- * button_defaults.js
- */
+commonWidgetTests( "button", {
+ defaults: {
+ disabled: null,
+ icons: {
+ primary: null,
+ secondary: null
+ },
+ label: null,
+ text: true,
-var button_defaults = {
- disabled: null,
- text: true,
- label: null,
- icons: {
- primary: null,
- secondary: null
+ // callbacks
+ create: null
}
-};
-
-commonWidgetTests('button', { defaults: button_defaults });
+});
diff --git a/tests/unit/dialog/dialog_defaults.js b/tests/unit/dialog/dialog_defaults.js
index 612fd58c8..9f2e4c6a8 100644
--- a/tests/unit/dialog/dialog_defaults.js
+++ b/tests/unit/dialog/dialog_defaults.js
@@ -1,35 +1,34 @@
-/*
- * dialog_defaults.js
- */
+commonWidgetTests( "dialog", {
+ defaults: {
+ autoOpen: true,
+ buttons: {},
+ closeOnEscape: true,
+ closeText: 'close',
+ disabled: false,
+ dialogClass: '',
+ draggable: true,
+ height: 'auto',
+ hide: null,
+ maxHeight: false,
+ maxWidth: false,
+ minHeight: 150,
+ minWidth: 150,
+ modal: false,
+ position: {
+ my: 'center',
+ at: 'center',
+ of: window,
+ collision: 'fit',
+ using: $.ui.dialog.prototype.options.position.using
+ },
+ resizable: true,
+ show: null,
+ stack: true,
+ title: '',
+ width: 300,
+ zIndex: 1000,
-var dialog_defaults = {
- autoOpen: true,
- buttons: {},
- closeOnEscape: true,
- closeText: 'close',
- disabled: false,
- dialogClass: '',
- draggable: true,
- height: 'auto',
- hide: null,
- maxHeight: false,
- maxWidth: false,
- minHeight: 150,
- minWidth: 150,
- modal: false,
- position: {
- my: 'center',
- at: 'center',
- of: window,
- collision: 'fit',
- using: $.ui.dialog.prototype.options.position.using
- },
- resizable: true,
- show: null,
- stack: true,
- title: '',
- width: 300,
- zIndex: 1000
-};
-
-commonWidgetTests('dialog', { defaults: dialog_defaults });
+ // callbacks
+ create: null
+ }
+});
diff --git a/tests/unit/dialog/dialog_options.js b/tests/unit/dialog/dialog_options.js
index fb8dea775..5705da079 100644
--- a/tests/unit/dialog/dialog_options.js
+++ b/tests/unit/dialog/dialog_options.js
@@ -180,7 +180,7 @@ test("height", function() {
expect(3);
el = $('<div></div>').dialog();
- equals(dlg().height(), dialog_defaults.minHeight, "default height");
+ equals(dlg().height(), 150, "default height");
el.remove();
el = $('<div></div>').dialog({ height: 237 });
@@ -431,7 +431,7 @@ test("width", function() {
expect(3);
el = $('<div></div>').dialog();
- equals(dlg().width(), dialog_defaults.width, "default width");
+ equals(dlg().width(), 300, "default width");
el.remove();
el = $('<div></div>').dialog({width: 437 });
diff --git a/tests/unit/menu/menu_defaults.js b/tests/unit/menu/menu_defaults.js
index 58122fea2..dd182ca09 100644
--- a/tests/unit/menu/menu_defaults.js
+++ b/tests/unit/menu/menu_defaults.js
@@ -1,13 +1,12 @@
-/*
- * menu_defaults.js
- */
+commonWidgetTests( "menu", {
+ defaults: {
+ disabled: false,
+ position: {
+ my: "left top",
+ at: "right top"
+ },
-var menu_defaults = {
- disabled: false,
- position: {
- my: "left top",
- at: "right top"
+ // callbacks
+ create: null
}
-};
-
-commonWidgetTests('menu', { defaults: menu_defaults });
+});
diff --git a/tests/unit/progressbar/progressbar_defaults.js b/tests/unit/progressbar/progressbar_defaults.js
index 925510871..3856e31a0 100644
--- a/tests/unit/progressbar/progressbar_defaults.js
+++ b/tests/unit/progressbar/progressbar_defaults.js
@@ -1,11 +1,10 @@
-/*
- * progressbar_defaults.js
- */
+commonWidgetTests( "progressbar", {
+ defaults: {
+ disabled: false,
+ value: 0,
+ max: 100,
-var progressbar_defaults = {
- disabled: false,
- value: 0,
- max: 100
-};
-
-commonWidgetTests('progressbar', { defaults: progressbar_defaults });
+ //callbacks
+ create: null
+ }
+});
diff --git a/tests/unit/slider/slider_defaults.js b/tests/unit/slider/slider_defaults.js
index 76e5da8ea..03f2a4f8e 100644
--- a/tests/unit/slider/slider_defaults.js
+++ b/tests/unit/slider/slider_defaults.js
@@ -1,20 +1,19 @@
-/*
- * slider_defaults.js
- */
+commonWidgetTests( "slider", {
+ defaults: {
+ animate: false,
+ cancel: function() {},
+ delay: 0,
+ disabled: false,
+ distance: 0,
+ max: 100,
+ min: 0,
+ orientation: 'horizontal',
+ range: false,
+ step: 1,
+ value: 0,
+ values: null,
-var slider_defaults = {
- animate: false,
- cancel: function() {},
- delay: 0,
- disabled: false,
- distance: 0,
- max: 100,
- min: 0,
- orientation: 'horizontal',
- range: false,
- step: 1,
- value: 0,
- values: null
-};
-
-commonWidgetTests('slider', { defaults: slider_defaults });
+ // callbacks
+ create: null
+ }
+});
diff --git a/tests/unit/spinner/spinner_defaults.js b/tests/unit/spinner/spinner_defaults.js
index 0389ab169..f6081b1f3 100644
--- a/tests/unit/spinner/spinner_defaults.js
+++ b/tests/unit/spinner/spinner_defaults.js
@@ -1,16 +1,15 @@
-/*
- * spinner_defaults.js
- */
+commonWidgetTests( "spinner", {
+ defaults: {
+ disabled: false,
+ incremental: true,
+ max: null,
+ min: null,
+ numberformat: null,
+ page: 10,
+ step: null,
+ value: null,
-var spinner_defaults = {
- disabled: false,
- incremental: true,
- max: null,
- min: null,
- numberformat: null,
- page: 10,
- step: null,
- value: null
-};
-
-commonWidgetTests('spinner', { defaults: spinner_defaults });
+ // callbacks
+ create: null
+ }
+});
diff --git a/tests/unit/tabs/tabs_defaults.js b/tests/unit/tabs/tabs_defaults.js
index 0750094e4..52b6f8a71 100644
--- a/tests/unit/tabs/tabs_defaults.js
+++ b/tests/unit/tabs/tabs_defaults.js
@@ -10,6 +10,7 @@ commonWidgetTests( "tabs", {
activate: null,
beforeActivate: null,
beforeLoad: null,
+ create: null,
load: null
}
});
diff --git a/tests/unit/tabs/tabs_defaults_deprecated.js b/tests/unit/tabs/tabs_defaults_deprecated.js
index 84f7de073..1a56297e9 100644
--- a/tests/unit/tabs/tabs_defaults_deprecated.js
+++ b/tests/unit/tabs/tabs_defaults_deprecated.js
@@ -18,6 +18,7 @@ commonWidgetTests( "tabs", {
add: null,
beforeActivate: null,
beforeLoad: null,
+ create: null,
disable: null,
enable: null,
load: null,
diff --git a/tests/unit/tooltip/tooltip_defaults.js b/tests/unit/tooltip/tooltip_defaults.js
index 419d7a085..c1fc49f1a 100644
--- a/tests/unit/tooltip/tooltip_defaults.js
+++ b/tests/unit/tooltip/tooltip_defaults.js
@@ -1,16 +1,15 @@
-/*
- * tooltip_defaults.js
- */
+commonWidgetTests( "tooltip", {
+ defaults: {
+ disabled: false,
+ items: "[title]",
+ content: $.ui.tooltip.prototype.options.content,
+ position: {
+ my: "left center",
+ at: "right center",
+ offset: "15 0"
+ },
-var tooltip_defaults = {
- disabled: false,
- items: "[title]",
- content: $.ui.tooltip.prototype.options.content,
- position: {
- my: "left center",
- at: "right center",
- offset: "15 0"
+ // callbacks
+ create: null
}
-};
-
-commonWidgetTests('tooltip', { defaults: tooltip_defaults });
+});
diff --git a/tests/unit/widget/widget_core.js b/tests/unit/widget/widget_core.js
index 5a6717560..b1c27b104 100644
--- a/tests/unit/widget/widget_core.js
+++ b/tests/unit/widget/widget_core.js
@@ -202,6 +202,7 @@ test( "merge multiple option arguments", function() {
$.widget( "ui.testWidget", {
_create: function() {
same( this.options, {
+ create: null,
disabled: false,
option1: "value1",
option2: "value2",
@@ -249,6 +250,7 @@ test( "._getCreateOptions()", function() {
},
_create: function() {
same( this.options, {
+ create: null,
disabled: false,
option1: "override1",
option2: "value2",
@@ -418,6 +420,7 @@ test( ".option() - getter", function() {
var options = div.testWidget( "option" );
same( options, {
+ create: null,
disabled: false,
foo: "bar",
baz: 5,
diff --git a/ui/jquery.ui.widget.js b/ui/jquery.ui.widget.js
index 27d08ccd2..55b9f7984 100644
--- a/ui/jquery.ui.widget.js
+++ b/ui/jquery.ui.widget.js
@@ -155,7 +155,10 @@ $.Widget.prototype = {
widgetEventPrefix: "",
defaultElement: "<div>",
options: {
- disabled: false
+ disabled: false,
+
+ // callbacks
+ create: null
},
_createWidget: function( options, element ) {
element = $( element || this.defaultElement || this )[ 0 ];