@@ -82,10 +82,14 @@ describe('compose.integration.spec.ts', () => {
82
82
} ) ;
83
83
84
84
it ( 'works with determineActivationStrategy() - replace' , async ( ) => {
85
+ let constructorCount = 0 ;
85
86
const { component, compose } = await bootstrapCompose (
86
87
`<compose view-model.bind="viewModel"></compose>` ,
87
88
{
88
89
viewModel : class {
90
+ constructor ( ) {
91
+ constructorCount ++ ;
92
+ }
89
93
// w/o the get view strategy, the initial composition fails, which results to undefined currentViewModel
90
94
getViewStrategy ( ) {
91
95
return new InlineViewStrategy ( '<template></template>' ) ;
@@ -104,18 +108,23 @@ describe('compose.integration.spec.ts', () => {
104
108
compose . modelChanged ( { a : 1 } , oldModel ) ;
105
109
106
110
taskQueue . queueMicroTask ( ( ) => {
111
+ expect ( constructorCount ) . toBe ( 2 , 'constructor count === 2' ) ;
107
112
expect ( compose . compositionEngine . compose ) . toHaveBeenCalledTimes ( 1 ) ;
108
113
component . dispose ( ) ;
109
114
} ) ;
110
115
111
116
} ) ;
112
117
113
118
it ( 'works with determineActivationStrategy() - invoke-lifecycle' , async ( ) => {
119
+ let constructorCount = 0 ;
114
120
let activationCount = 0 ;
115
121
const { component, compose } = await bootstrapCompose (
116
122
`<compose view-model.bind="viewModel"></compose>` ,
117
123
{
118
124
viewModel : class {
125
+ constructor ( ) {
126
+ constructorCount ++ ;
127
+ }
119
128
activate ( ) {
120
129
activationCount ++ ;
121
130
}
@@ -138,6 +147,7 @@ describe('compose.integration.spec.ts', () => {
138
147
compose . modelChanged ( { } , oldModel ) ;
139
148
140
149
taskQueue . queueMicroTask ( ( ) => {
150
+ expect ( constructorCount ) . toBe ( 1 , 'constructor count === 1' ) ;
141
151
expect ( activationCount ) . toBe ( 2 , 'activation count === 2' ) ;
142
152
component . dispose ( ) ;
143
153
} ) ;
0 commit comments