jquery-ui/tests/unit/widget/widget_tickets.js

47 lines
1.0 KiB
JavaScript
Raw Normal View History

/*
* widget unit tests
*/
2010-08-26 16:05:40 +00:00
(function( $ ) {
2010-08-26 16:05:40 +00:00
module( "widget: tickets" );
2010-08-26 16:05:40 +00:00
test( "#5830 - Widget: Using inheritance overwrites the base classes options", function() {
$.widget( "ui.testWidgetBase", {
options: {
obj: {
key1: "foo",
key2: "bar"
},
arr: [ "testing" ]
}
});
2010-08-26 16:05:40 +00:00
$.widget( "ui.testWidgetExtension", $.ui.testWidgetBase, {
options: {
obj: {
key1: "baz"
},
arr: [ "alpha", "beta" ]
}
});
2010-08-26 16:05:40 +00:00
same( $.ui.testWidgetBase.prototype.options.obj, {
key1: "foo",
key2: "bar"
}, "base class option object not overridden");
same( $.ui.testWidgetBase.prototype.options.arr, [ "testing" ],
"base class option array not overridden");
same( $.ui.testWidgetExtension.prototype.options.obj, {
key1: "baz",
key2: "bar"
}, "extension class option object extends base");
same( $.ui.testWidgetExtension.prototype.options.arr, [ "alpha", "beta" ],
"extension class option array overwrites base");
2010-08-26 16:05:40 +00:00
delete $.ui.testWidgetBase;
delete $.ui.testWidgetExtension;
});
2010-08-26 16:05:40 +00:00
})( jQuery );