@@ -580,19 +580,23 @@ describe("ReactiveFunction", function() {
580
580
assert . equal ( serialized . nodes . length , 3 ) ;
581
581
assert . equal ( serialized . links . length , 2 ) ;
582
582
583
- assert . equal ( serialized . nodes [ 0 ] . id , "fullName " ) ;
584
- assert . equal ( serialized . nodes [ 1 ] . id , "firstName " ) ;
585
- assert . equal ( serialized . nodes [ 2 ] . id , "lastName " ) ;
583
+ assert . equal ( serialized . nodes [ 0 ] . id , "56 " ) ;
584
+ assert . equal ( serialized . nodes [ 1 ] . id , "57 " ) ;
585
+ assert . equal ( serialized . nodes [ 2 ] . id , "58 " ) ;
586
586
587
- assert . equal ( serialized . links [ 0 ] . source , "firstName" ) ;
588
- assert . equal ( serialized . links [ 0 ] . target , "fullName" ) ;
589
- assert . equal ( serialized . links [ 1 ] . source , "lastName" ) ;
590
- assert . equal ( serialized . links [ 1 ] . target , "fullName" ) ;
587
+ assert . equal ( serialized . nodes [ 0 ] . propertyName , "fullName" ) ;
588
+ assert . equal ( serialized . nodes [ 1 ] . propertyName , "firstName" ) ;
589
+ assert . equal ( serialized . nodes [ 2 ] . propertyName , "lastName" ) ;
590
+
591
+ assert . equal ( serialized . links [ 0 ] . source , "57" ) ;
592
+ assert . equal ( serialized . links [ 0 ] . target , "56" ) ;
593
+ assert . equal ( serialized . links [ 1 ] . source , "58" ) ;
594
+ assert . equal ( serialized . links [ 1 ] . target , "56" ) ;
591
595
592
596
rf . destroy ( ) ;
593
597
} ) ;
594
598
595
- it ( "Should serialize the data flow graph, falling back to property ids ." , function ( ) {
599
+ it ( "Should serialize the data flow graph and omit property names if they are not present ." , function ( ) {
596
600
597
601
var firstName = ReactiveProperty ( "Jane" ) ;
598
602
var lastName = ReactiveProperty ( "Smith" ) ;
@@ -618,6 +622,8 @@ describe("ReactiveFunction", function() {
618
622
assert . equal ( serialized . nodes [ 1 ] . id , "60" ) ;
619
623
assert . equal ( serialized . nodes [ 2 ] . id , "61" ) ;
620
624
625
+ assert . equal ( typeof serialized . nodes [ 0 ] . propertyName , "undefined" ) ;
626
+
621
627
assert . equal ( serialized . links [ 0 ] . source , "60" ) ;
622
628
assert . equal ( serialized . links [ 0 ] . target , "59" ) ;
623
629
assert . equal ( serialized . links [ 1 ] . source , "61" ) ;
@@ -626,7 +632,7 @@ describe("ReactiveFunction", function() {
626
632
rf . destroy ( ) ;
627
633
} ) ;
628
634
629
- it ( "Should serialize without any output specified ( empty string as name) ." , function ( ) {
635
+ it ( "Should serialize case without any output specified and use empty string as property name." , function ( ) {
630
636
var a = ReactiveProperty ( 5 ) ;
631
637
var b = ReactiveProperty ( 10 ) ;
632
638
var sideEffect = 0 ;
@@ -649,12 +655,16 @@ describe("ReactiveFunction", function() {
649
655
//console.log(JSON.stringify(serialized, null, 2));
650
656
651
657
assert . equal ( serialized . nodes [ 0 ] . id , "62" ) ;
652
- assert . equal ( serialized . nodes [ 1 ] . id , "a" ) ;
653
- assert . equal ( serialized . nodes [ 2 ] . id , "b" ) ;
658
+ assert . equal ( serialized . nodes [ 1 ] . id , "63" ) ;
659
+ assert . equal ( serialized . nodes [ 2 ] . id , "64" ) ;
660
+
661
+ assert . equal ( serialized . nodes [ 0 ] . propertyName , "" ) ;
662
+ assert . equal ( serialized . nodes [ 1 ] . propertyName , "a" ) ;
663
+ assert . equal ( serialized . nodes [ 2 ] . propertyName , "b" ) ;
654
664
655
- assert . equal ( serialized . links [ 0 ] . source , "a " ) ;
665
+ assert . equal ( serialized . links [ 0 ] . source , "63 " ) ;
656
666
assert . equal ( serialized . links [ 0 ] . target , "62" ) ;
657
- assert . equal ( serialized . links [ 1 ] . source , "b " ) ;
667
+ assert . equal ( serialized . links [ 1 ] . source , "64 " ) ;
658
668
assert . equal ( serialized . links [ 1 ] . target , "62" ) ;
659
669
660
670
rf . destroy ( ) ;
0 commit comments