diff options
author | Scott González <scott.gonzalez@gmail.com> | 2010-01-15 18:58:20 +0000 |
---|---|---|
committer | Scott González <scott.gonzalez@gmail.com> | 2010-01-15 18:58:20 +0000 |
commit | 7d96a0d0966d9e680c968db2869900ac624a44ad (patch) | |
tree | 88076c2f23bb64749d7af87bc26991798dcff915 /tests | |
parent | ab153e07c78098567b9f1e53deb9145bcd6c22d3 (diff) | |
download | jquery-ui-7d96a0d0966d9e680c968db2869900ac624a44ad.tar.gz jquery-ui-7d96a0d0966d9e680c968db2869900ac624a44ad.zip |
Widget factory: Changed _create to _init.
Partial fix for #5064 - Widget: make multiple instantiation more useful.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/unit/widget/widget.js | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/tests/unit/widget/widget.js b/tests/unit/widget/widget.js index 3e7d9aaa6..3c870f1fe 100644 --- a/tests/unit/widget/widget.js +++ b/tests/unit/widget/widget.js @@ -11,14 +11,14 @@ module('widget factory', { test('widget creation', function() { var myPrototype = { - _init: function() {}, + _create: function() {}, creationTest: function() {} }; $.widget('ui.testWidget', myPrototype); ok($.isFunction($.ui.testWidget), 'constructor was created'); equals('object', typeof $.ui.testWidget.prototype, 'prototype was created'); - equals($.ui.testWidget.prototype._init, myPrototype._init, 'init function is copied over'); + equals($.ui.testWidget.prototype._create, myPrototype._create, 'create function is copied over'); equals($.ui.testWidget.prototype.creationTest, myPrototype.creationTest, 'random function is copied over'); equals($.ui.testWidget.prototype.option, $.Widget.prototype.option, 'option method copied over from base widget'); }); @@ -30,7 +30,7 @@ test('jQuery usage', function() { $.widget('ui.testWidget', { getterSetterVal: 5, - _init: function() { + _create: function() { ok(shouldInit, 'init called on instantiation'); }, methodWithParams: function(param1, param2) { @@ -73,7 +73,7 @@ test('direct usage', function() { $.widget('ui.testWidget', { getterSetterVal: 5, - _init: function() { + _create: function() { ok(shouldInit, 'init called on instantiation'); }, methodWithParams: function(param1, param2) { @@ -113,7 +113,7 @@ test('direct usage', function() { test('merge multiple option arguments', function() { expect(1); $.widget("ui.testWidget", { - _init: function() { + _create: function() { same(this.options, { disabled: false, option1: "value1", @@ -148,7 +148,7 @@ test('merge multiple option arguments', function() { test(".widget() - base", function() { $.widget("ui.testWidget", { - _init: function() {} + _create: function() {} }); var div = $("<div></div>").testWidget() same(div[0], div.testWidget("widget")[0]); @@ -157,7 +157,7 @@ test(".widget() - base", function() { test(".widget() - overriden", function() { var wrapper = $("<div></div>"); $.widget("ui.testWidget", { - _init: function() {}, + _create: function() {}, widget: function() { return wrapper; } |