@@ -535,7 +535,7 @@ test( ".option() - delegate to ._setOptions()", function() {
535
535
} ) ;
536
536
537
537
test ( ".option() - delegate to ._setOption()" , function ( ) {
538
- expect ( 2 ) ;
538
+ expect ( 3 ) ;
539
539
var div ,
540
540
calls = [ ] ;
541
541
$ . widget ( "ui.testWidget" , {
@@ -554,6 +554,11 @@ test( ".option() - delegate to ._setOption()", function() {
554
554
deepEqual ( calls , [ { key : "foo" , val : "bar" } ] ,
555
555
"_setOption called for single option" ) ;
556
556
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
+
557
562
calls = [ ] ;
558
563
div . testWidget ( "option" , {
559
564
bar : "qux" ,
@@ -566,9 +571,9 @@ test( ".option() - delegate to ._setOption()", function() {
566
571
} ) ;
567
572
568
573
test ( ".option() - deep option setter" , function ( ) {
569
- expect ( 6 ) ;
574
+ expect ( 9 ) ;
570
575
$ . widget ( "ui.testWidget" , { } ) ;
571
- var div = $ ( "<div>" ) . testWidget ( ) ;
576
+ var result , div = $ ( "<div>" ) . testWidget ( ) ;
572
577
function deepOption ( from , to , msg ) {
573
578
div . data ( "ui-testWidget" ) . options . foo = from ;
574
579
$ . ui . testWidget . prototype . _setOption = function ( key , value ) {
@@ -580,6 +585,12 @@ test( ".option() - deep option setter", function() {
580
585
deepOption ( { bar : "baz" } , { bar : "qux" } , "one deep" ) ;
581
586
div . testWidget ( "option" , "foo.bar" , "qux" ) ;
582
587
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
+
583
594
deepOption ( null , { bar : "baz" } , "null" ) ;
584
595
div . testWidget ( "option" , "foo.bar" , "baz" ) ;
585
596
0 commit comments