@@ -34,12 +34,12 @@ export async function render<ComponentType>(
34
34
) : Promise < RenderResult < ComponentType , ComponentType > > ;
35
35
export async function render < DirectiveType , WrapperType = WrapperComponent > (
36
36
component : Type < DirectiveType > ,
37
- renderOptions ?: RenderDirectiveOptions < DirectiveType , WrapperType > ,
38
- ) : Promise < RenderResult < DirectiveType , WrapperType > > ;
37
+ renderOptions ?: RenderDirectiveOptions < WrapperType > ,
38
+ ) : Promise < RenderResult < WrapperType > > ;
39
39
40
40
export async function render < SutType , WrapperType = SutType > (
41
41
sut : Type < SutType > ,
42
- renderOptions : RenderComponentOptions < SutType > | RenderDirectiveOptions < SutType , WrapperType > = { } ,
42
+ renderOptions : RenderComponentOptions < SutType > | RenderDirectiveOptions < WrapperType > = { } ,
43
43
) : Promise < RenderResult < SutType > > {
44
44
const {
45
45
detectChanges : detectChangesOnRender = true ,
@@ -55,7 +55,7 @@ export async function render<SutType, WrapperType = SutType>(
55
55
excludeComponentDeclaration = false ,
56
56
routes,
57
57
removeAngularAttributes = false ,
58
- } = renderOptions as RenderDirectiveOptions < SutType , WrapperType > ;
58
+ } = renderOptions as RenderDirectiveOptions < WrapperType > ;
59
59
60
60
const config = getConfig ( ) ;
61
61
@@ -191,7 +191,7 @@ async function createComponent<SutType>(component: Type<SutType>): Promise<Compo
191
191
192
192
async function createComponentFixture < SutType > (
193
193
component : Type < SutType > ,
194
- { template, wrapper } : Pick < RenderDirectiveOptions < SutType , any > , 'template' | 'wrapper' > ,
194
+ { template, wrapper } : Pick < RenderDirectiveOptions < any > , 'template' | 'wrapper' > ,
195
195
) : Promise < ComponentFixture < SutType > > {
196
196
if ( template ) {
197
197
TestBed . overrideTemplate ( wrapper , template ) ;
@@ -205,7 +205,14 @@ function setComponentProperties<SutType>(
205
205
{ componentProperties = { } } : Pick < RenderDirectiveOptions < SutType , any > , 'componentProperties' > ,
206
206
) {
207
207
for ( const key of Object . keys ( componentProperties ) ) {
208
- fixture . componentInstance [ key ] = componentProperties [ key ] ;
208
+ let _value = componentProperties [ key ] ;
209
+ Object . defineProperty ( fixture . componentInstance , key , {
210
+ get : ( ) => _value ,
211
+ set : ( value ) => {
212
+ _value = value ;
213
+ fixture . detectChanges ( ) ;
214
+ }
215
+ } ) ;
209
216
}
210
217
return fixture ;
211
218
}
@@ -235,7 +242,7 @@ function addAutoDeclarations<SutType>(
235
242
template,
236
243
wrapper,
237
244
} : Pick <
238
- RenderDirectiveOptions < SutType , any > ,
245
+ RenderDirectiveOptions < any > ,
239
246
'declarations' | 'excludeComponentDeclaration' | 'template' | 'wrapper'
240
247
> ,
241
248
) {
0 commit comments