@@ -19,7 +19,13 @@ const parseObservableMarble = <T>(
19
19
const frameOffset = subscriptionIndex < 0 ? 0 : subscriptionIndex ;
20
20
21
21
const values = Array . from ( marble ) . filter ( token => token !== ObservableMarbleToken . NOOP ) . slice ( frameOffset ) . reduce ( (
22
- acc : { currentOffset : number ; messages : Array < TestMessage < T > > ; simultaneousGrouped : boolean } ,
22
+ acc : {
23
+ currentOffset : number ;
24
+ messages : Array < TestMessage < T > > ;
25
+ simultaneousGrouped : boolean ;
26
+ expanding : boolean ;
27
+ expandingValue : Array < string > ;
28
+ } ,
23
29
token : any
24
30
) => {
25
31
let message : TestMessage < T > | null = null ;
@@ -35,6 +41,14 @@ const parseObservableMarble = <T>(
35
41
message = new TestMessageValue < T > ( acc . currentOffset , Notification . createComplete ( ) ) ;
36
42
break ;
37
43
case ObservableMarbleToken . TIMEFRAME_EXPAND :
44
+ if ( acc . expandingValue . length === 0 && ! acc . expanding ) {
45
+ acc . expandingValue . splice ( 0 ) ;
46
+ acc . expanding = true ;
47
+ } else if ( acc . expandingValue . length > 0 && acc . expanding ) {
48
+ acc . expanding = false ;
49
+ const expandedFrame = parseInt ( acc . expandingValue . join ( '' ) , 10 ) ;
50
+ acc . currentOffset += expandedFrame * frameTimeFactor ;
51
+ }
38
52
break ;
39
53
case ObservableMarbleToken . SIMULTANEOUS_START :
40
54
acc . simultaneousGrouped = true ;
@@ -46,8 +60,12 @@ const parseObservableMarble = <T>(
46
60
case SubscriptionMarbleToken . SUBSCRIBE :
47
61
break ;
48
62
default :
49
- const customValue = value && value [ token ] ? value [ token ] : token ;
50
- message = new TestMessageValue < T > ( acc . currentOffset , Notification . createNext < T > ( customValue ) ) ;
63
+ if ( acc . expanding ) {
64
+ acc . expandingValue . push ( token ) ;
65
+ } else {
66
+ const customValue = value && value [ token ] ? value [ token ] : token ;
67
+ message = new TestMessageValue < T > ( acc . currentOffset , Notification . createNext < T > ( customValue ) ) ;
68
+ }
51
69
}
52
70
53
71
if ( ! ! message ) {
@@ -61,7 +79,9 @@ const parseObservableMarble = <T>(
61
79
} , {
62
80
currentOffset : frameOffset ,
63
81
messages : [ ] ,
64
- simultaneousGrouped : false
82
+ simultaneousGrouped : false ,
83
+ expanding : false ,
84
+ expandingValue : [ ]
65
85
} ) ;
66
86
67
87
return values . messages ;
0 commit comments