@@ -535,7 +535,7 @@ test( ".option() - delegate to ._setOptions()", function() {
535535} ) ;
536536
537537test ( ".option() - delegate to ._setOption()" , function ( ) {
538- expect ( 2 ) ;
538+ expect ( 3 ) ;
539539 var div ,
540540 calls = [ ] ;
541541 $ . widget ( "ui.testWidget" , {
@@ -554,6 +554,11 @@ test( ".option() - delegate to ._setOption()", function() {
554554 deepEqual ( calls , [ { key : "foo" , val : "bar" } ] ,
555555 "_setOption called for single option" ) ;
556556
557+ calls = [ ] ;
558+ div . testWidget ( "option" , "foo" , undefined ) ;
559+ deepEqual ( calls , [ { key : "foo" , val : undefined } ] ,
560+ "_setOption called for single option where value is undefined" ) ;
561+
557562 calls = [ ] ;
558563 div . testWidget ( "option" , {
559564 bar : "qux" ,
@@ -566,9 +571,9 @@ test( ".option() - delegate to ._setOption()", function() {
566571} ) ;
567572
568573test ( ".option() - deep option setter" , function ( ) {
569- expect ( 6 ) ;
574+ expect ( 9 ) ;
570575 $ . widget ( "ui.testWidget" , { } ) ;
571- var div = $ ( "<div>" ) . testWidget ( ) ;
576+ var result , div = $ ( "<div>" ) . testWidget ( ) ;
572577 function deepOption ( from , to , msg ) {
573578 div . data ( "ui-testWidget" ) . options . foo = from ;
574579 $ . ui . testWidget . prototype . _setOption = function ( key , value ) {
@@ -580,6 +585,12 @@ test( ".option() - deep option setter", function() {
580585 deepOption ( { bar : "baz" } , { bar : "qux" } , "one deep" ) ;
581586 div . testWidget ( "option" , "foo.bar" , "qux" ) ;
582587
588+ deepOption ( { bar : "baz" } , { bar : undefined } , "one deep - value = undefined" ) ;
589+
590+ result = div . testWidget ( "option" , "foo.bar" , undefined ) ;
591+
592+ deepEqual ( result , div , "option should return widget on successful set operation" ) ;
593+
583594 deepOption ( null , { bar : "baz" } , "null" ) ;
584595 div . testWidget ( "option" , "foo.bar" , "baz" ) ;
585596
0 commit comments