@@ -32,7 +32,7 @@ import {
32
32
RenderComponentOptions ,
33
33
RenderResult ,
34
34
RenderTemplateOptions ,
35
- SubscribeToOutputsKeysWithCallback ,
35
+ OutputRefKeysWithCallback ,
36
36
} from './models' ;
37
37
import { getConfig } from './config' ;
38
38
@@ -67,7 +67,7 @@ export async function render<SutType, WrapperType = SutType>(
67
67
componentProperties = { } ,
68
68
componentInputs = { } ,
69
69
componentOutputs = { } ,
70
- subscribeToOutputs = { } ,
70
+ on = { } ,
71
71
componentProviders = [ ] ,
72
72
childComponentOverrides = [ ] ,
73
73
componentImports : componentImports ,
@@ -185,7 +185,7 @@ export async function render<SutType, WrapperType = SutType>(
185
185
properties : Partial < SutType > ,
186
186
inputs : Partial < SutType > ,
187
187
outputs : Partial < SutType > ,
188
- subscribeTo : SubscribeToOutputsKeysWithCallback < SutType > ,
188
+ subscribeTo : OutputRefKeysWithCallback < SutType > ,
189
189
) : Promise < ComponentFixture < SutType > > => {
190
190
const createdFixture : ComponentFixture < SutType > = await createComponent ( componentContainer ) ;
191
191
setComponentProperties ( createdFixture , properties ) ;
@@ -224,7 +224,7 @@ export async function render<SutType, WrapperType = SutType>(
224
224
return createdFixture ;
225
225
} ;
226
226
227
- const fixture = await renderFixture ( componentProperties , componentInputs , componentOutputs , subscribeToOutputs ) ;
227
+ const fixture = await renderFixture ( componentProperties , componentInputs , componentOutputs , on ) ;
228
228
229
229
if ( deferBlockStates ) {
230
230
if ( Array . isArray ( deferBlockStates ) ) {
@@ -239,7 +239,7 @@ export async function render<SutType, WrapperType = SutType>(
239
239
const rerender = async (
240
240
properties ?: Pick <
241
241
RenderTemplateOptions < SutType > ,
242
- 'componentProperties' | 'componentInputs' | 'componentOutputs' | 'subscribeToOutputs ' | 'detectChangesOnRender'
242
+ 'componentProperties' | 'componentInputs' | 'componentOutputs' | 'on ' | 'detectChangesOnRender'
243
243
> & { partialUpdate ?: boolean } ,
244
244
) => {
245
245
const newComponentInputs = properties ?. componentInputs ?? { } ;
@@ -262,15 +262,15 @@ export async function render<SutType, WrapperType = SutType>(
262
262
renderedOutputKeys = Object . keys ( newComponentOutputs ) ;
263
263
264
264
// first unsubscribe the no longer available or changed callback-fns
265
- const newSubscribeToOutputs : SubscribeToOutputsKeysWithCallback < SutType > = properties ?. subscribeToOutputs ?? { } ;
265
+ const newObservableSubscriptions : OutputRefKeysWithCallback < SutType > = properties ?. on ?? { } ;
266
266
for ( const [ key , cb , subscription ] of subscribedOutputs ) {
267
267
// when no longer provided or when the callback has changed
268
- if ( ! ( key in newSubscribeToOutputs ) || cb !== ( newSubscribeToOutputs as any ) [ key ] ) {
268
+ if ( ! ( key in newObservableSubscriptions ) || cb !== ( newObservableSubscriptions as any ) [ key ] ) {
269
269
subscription . unsubscribe ( ) ;
270
270
}
271
271
}
272
272
// then subscribe the new callback-fns
273
- subscribedOutputs = Object . entries ( newSubscribeToOutputs ) . map ( ( [ key , cb ] ) => {
273
+ subscribedOutputs = Object . entries ( newObservableSubscriptions ) . map ( ( [ key , cb ] ) => {
274
274
const existing = subscribedOutputs . find ( ( [ k ] ) => k === key ) ;
275
275
return existing && existing [ 1 ] === cb
276
276
? existing // nothing to do
@@ -388,7 +388,7 @@ function setComponentInputs<SutType>(
388
388
389
389
function subscribeToComponentOutputs < SutType > (
390
390
fixture : ComponentFixture < SutType > ,
391
- listeners : SubscribeToOutputsKeysWithCallback < SutType > ,
391
+ listeners : OutputRefKeysWithCallback < SutType > ,
392
392
) : SubscribedOutput < SutType > [ ] {
393
393
// with Object.entries we lose the type information of the key and callback, therefore we need to cast them
394
394
return Object . entries ( listeners ) . map ( ( [ key , cb ] ) =>
0 commit comments