@@ -596,9 +596,8 @@ describe("ReactiveFunction", function() {
596
596
597
597
var firstName = ReactiveProperty ( "Jane" ) ;
598
598
var lastName = ReactiveProperty ( "Smith" ) ;
599
- var fullName = ReactiveProperty ( ) ;
600
-
601
- ReactiveFunction ( {
599
+ var fullName = ReactiveProperty ( ) ;
600
+ var rf = ReactiveFunction ( {
602
601
inputs : [ firstName , lastName ] ,
603
602
output : fullName ,
604
603
callback : function ( first , last ) {
@@ -624,5 +623,40 @@ describe("ReactiveFunction", function() {
624
623
assert . equal ( serialized . links [ 1 ] . source , "61" ) ;
625
624
assert . equal ( serialized . links [ 1 ] . target , "59" ) ;
626
625
626
+ rf . destroy ( ) ;
627
+ } ) ;
628
+
629
+ it ( "Should serialize without any output specified (empty string as name)." , function ( ) {
630
+ var a = ReactiveProperty ( 5 ) ;
631
+ var b = ReactiveProperty ( 10 ) ;
632
+ var sideEffect = 0 ;
633
+
634
+ var rf = ReactiveFunction ( {
635
+ inputs : [ a , b ] ,
636
+ callback : function ( a , b ) {
637
+ sideEffect ++ ;
638
+ }
639
+ } ) ;
640
+
641
+ // For serialization.
642
+ a . propertyName = "a" ;
643
+ b . propertyName = "b" ;
644
+ var serialized = ReactiveFunction . serializeGraph ( ) ;
645
+
646
+ assert . equal ( serialized . nodes . length , 3 ) ;
647
+ assert . equal ( serialized . links . length , 2 ) ;
648
+
649
+ //console.log(JSON.stringify(serialized, null, 2));
650
+
651
+ assert . equal ( serialized . nodes [ 0 ] . id , "62" ) ;
652
+ assert . equal ( serialized . nodes [ 1 ] . id , "a" ) ;
653
+ assert . equal ( serialized . nodes [ 2 ] . id , "b" ) ;
654
+
655
+ assert . equal ( serialized . links [ 0 ] . source , "a" ) ;
656
+ assert . equal ( serialized . links [ 0 ] . target , "62" ) ;
657
+ assert . equal ( serialized . links [ 1 ] . source , "b" ) ;
658
+ assert . equal ( serialized . links [ 1 ] . target , "62" ) ;
659
+
660
+ rf . destroy ( ) ;
627
661
} ) ;
628
662
} ) ;
0 commit comments