@@ -228,6 +228,59 @@ test( "re-init", function() {
228
228
same ( actions , [ "optionfoo" , "init" ] , "correct methods called on re-init with options" ) ;
229
229
} ) ;
230
230
231
+ test ( "._super()" , function ( ) {
232
+ expect ( 6 ) ;
233
+ var instance ;
234
+ $ . widget ( "ui.testWidget" , {
235
+ method : function ( a , b ) {
236
+ same ( this , instance , "this is correct in super widget" ) ;
237
+ same ( a , 5 , "parameter passed to super widget" ) ;
238
+ same ( b , 10 , "second parameter passed to super widget" ) ;
239
+ return a + b ;
240
+ }
241
+ } ) ;
242
+
243
+ $ . widget ( "ui.testWidget2" , $ . ui . testWidget , {
244
+ method : function ( a ) {
245
+ same ( this , instance , "this is correct in widget" ) ;
246
+ same ( a , 5 , "parameter passed to widget" ) ;
247
+ var ret = this . _super ( "method" , a , a * 2 ) ;
248
+ same ( ret , 15 , "super returned value" ) ;
249
+ }
250
+ } ) ;
251
+
252
+ instance = $ ( "<div>" ) . testWidget2 ( ) . data ( "testWidget2" ) ;
253
+ instance . method ( 5 ) ;
254
+ delete $ . ui . testWidget2 ;
255
+ } ) ;
256
+
257
+ test ( "._superApply()" , function ( ) {
258
+ expect ( 7 ) ;
259
+ var instance ;
260
+ $ . widget ( "ui.testWidget" , {
261
+ method : function ( a , b ) {
262
+ same ( this , instance , "this is correct in super widget" ) ;
263
+ same ( a , 5 , "parameter passed to super widget" ) ;
264
+ same ( b , 10 , "second parameter passed to super widget" ) ;
265
+ return a + b ;
266
+ }
267
+ } ) ;
268
+
269
+ $ . widget ( "ui.testWidget2" , $ . ui . testWidget , {
270
+ method : function ( a , b ) {
271
+ same ( this , instance , "this is correct in widget" ) ;
272
+ same ( a , 5 , "parameter passed to widget" ) ;
273
+ same ( b , 10 , "second parameter passed to widget" ) ;
274
+ var ret = this . _superApply ( "method" , arguments ) ;
275
+ same ( ret , 15 , "super returned value" ) ;
276
+ }
277
+ } ) ;
278
+
279
+ instance = $ ( "<div>" ) . testWidget2 ( ) . data ( "testWidget2" ) ;
280
+ instance . method ( 5 , 10 ) ;
281
+ delete $ . ui . testWidget2 ;
282
+ } ) ;
283
+
231
284
test ( ".option() - getter" , function ( ) {
232
285
$ . widget ( "ui.testWidget" , {
233
286
_create : function ( ) { }
0 commit comments