});
});
+test( "_getCreateOptions()", function() {
+ expect( 1 );
+ $.widget( "ui.testWidget", {
+ options: {
+ option1: "valuex",
+ option2: "valuex",
+ option3: "value3",
+ },
+ _getCreateOptions: function() {
+ return {
+ option1: "override1",
+ option2: "overideX",
+ };
+ },
+ _create: function() {
+ same( this.options, {
+ disabled: false,
+ option1: "override1",
+ option2: "value2",
+ option3: "value3"
+ });
+ }
+ });
+ $( "<div>" ).testWidget({ option2: "value2" });
+});
+
test( "re-init", function() {
var div = $( "<div></div>" ),
actions = [];
this.element = $( element );
this.options = $.extend( true, {},
this.options,
- $.metadata && $.metadata.get( element )[ this.widgetName ],
+ this._getCreateOptions(),
options );
var self = this;
this._trigger( "create" );
this._init();
},
+ _getCreateOptions: function() {
+ var options = {};
+ if ( $.metadata ) {
+ options = $.metadata.get( element )[ this.widgetName ];
+ }
+ return options;
+ },
_create: function() {},
_init: function() {},