@@ -76,6 +76,44 @@ export async function render<WrapperType = WrapperComponent>(
76
76
77
77
## Component RenderOptions
78
78
79
+
80
+ ### ` inputs `
81
+
82
+ An object to set ` @Input ` or ` input() ` properties of the component .
83
+
84
+ ** default ** : ` {} `
85
+
86
+ ` ` ` typescript
87
+ await render(AppComponent, {
88
+ inputs: {
89
+ counterValue: 10,
90
+ // explicitly define aliases using ` aliasedInput `
91
+ ...aliasedInput('someAlias', 'someValue'),
92
+ },
93
+ })
94
+ ` ` `
95
+
96
+ ### ` on `
97
+
98
+ An object with callbacks to subscribe to ` EventEmitters ` and ` Observables ` of
99
+ the component .
100
+
101
+ ** default ** : ` {} `
102
+
103
+ ` ` ` ts
104
+ // using a manual callback
105
+ const sendValue = (value) => { ... }
106
+ // using a (jest) spy
107
+ const sendValueSpy = jest.fn()
108
+
109
+ await render(AppComponent, {
110
+ on: {
111
+ send: (value) => sendValue(value),
112
+ send: sendValueSpy
113
+ }
114
+ })
115
+ ` ` `
116
+
79
117
### ` declarations `
80
118
81
119
A collection of components , directives and pipes needed to render the component .
@@ -348,45 +386,66 @@ await render(AppComponent, {
348
386
})
349
387
` ` `
350
388
351
- ## ` RenderResult `
352
389
353
- ### ` inputs `
390
+ ### ~~ ` componentInputs ` ~~ ( deprecated )
354
391
355
- An object to set ` @Input ` or ` input() ` properties of the component .
392
+ An object to set ` @Input ` properties of the component . Uses ` setInput ` to set
393
+ the input property . Throws if the component property is not annotated with the
394
+ ` @Input ` attribute .
356
395
357
396
** default ** : ` {} `
358
397
398
+ ** example ** :
399
+
359
400
` ` ` typescript
360
401
await render(AppComponent, {
361
- inputs : {
402
+ componentInputs : {
362
403
counterValue: 10,
363
- // explicitly define aliases using ` aliasedInput `
364
- ...aliasedInput('someAlias', 'someValue'),
365
404
},
366
405
})
367
406
` ` `
368
407
369
- ### ` on `
408
+ ### ~~ ` componentOutputs ` ~~ ( deprecated )
370
409
371
- An object with callbacks to subscribe to ` EventEmitters ` and ` Observables ` of
372
- the component .
410
+ An object to set ` @Output ` properties of the component .
373
411
374
412
** default ** : ` {} `
375
413
376
- ` ` ` ts
377
- // using a manual callback
378
- const sendValue = (value) => { ... }
379
- // using a (jest) spy
380
- const sendValueSpy = jest.fn()
414
+ ** example ** :
381
415
416
+ ` ` ` typescript
382
417
await render(AppComponent, {
383
- on: {
384
- send: (value) => sendValue(value),
385
- send: sendValueSpy
418
+ componentOutputs: {
419
+ clicked: (value) => { ... }
386
420
}
387
421
})
388
422
` ` `
389
423
424
+ ### ~~ ` componentProperties ` ~~ (deprecated )
425
+
426
+ An object to set ` @Input ` and ` @Output ` properties of the component . Doesn ' t
427
+ have a fine - grained control as ` inputs ` and ` on ` .
428
+
429
+ ** default ** : ` {} `
430
+
431
+ ** example ** :
432
+
433
+ ` ` ` typescript
434
+ await render(AppComponent, {
435
+ componentProperties: {
436
+ // an input
437
+ counterValue: 10,
438
+ // an output
439
+ send: (value) => { ... }
440
+ // a public property
441
+ name: 'Tim'
442
+ }
443
+ })
444
+ ` ` `
445
+
446
+
447
+ ## ` RenderResult `
448
+
390
449
### ` container `
391
450
392
451
The containing DOM node of your rendered Angular Component . This is a regular
@@ -530,59 +589,3 @@ expect(screen.getByText(/loading/i)).toBeInTheDocument()
530
589
await renderDeferBlock(DeferBlockState.Complete)
531
590
expect(screen.getByText(/completed/i)).toBeInTheDocument()
532
591
` ` `
533
-
534
- ### ~~ ` componentInputs ` ~~ (deprecated )
535
-
536
- An object to set ` @Input ` properties of the component . Uses ` setInput ` to set
537
- the input property . Throws if the component property is not annotated with the
538
- ` @Input ` attribute .
539
-
540
- ** default ** : ` {} `
541
-
542
- ** example ** :
543
-
544
- ` ` ` typescript
545
- await render(AppComponent, {
546
- componentInputs: {
547
- counterValue: 10,
548
- },
549
- })
550
- ` ` `
551
-
552
- ### ~~ ` componentOutputs ` ~~ (deprecated )
553
-
554
- An object to set ` @Output ` properties of the component .
555
-
556
- ** default ** : ` {} `
557
-
558
- ** example ** :
559
-
560
- ` ` ` typescript
561
- await render(AppComponent, {
562
- componentOutputs: {
563
- clicked: (value) => { ... }
564
- }
565
- })
566
- ` ` `
567
-
568
- ### ~~ ` componentProperties ` ~~ (deprecated )
569
-
570
- An object to set ` @Input ` and ` @Output ` properties of the component . Doesn ' t
571
- have a fine - grained control as ` inputs ` and ` on ` .
572
-
573
- ** default ** : ` {} `
574
-
575
- ** example ** :
576
-
577
- ` ` ` typescript
578
- await render(AppComponent, {
579
- componentProperties: {
580
- // an input
581
- counterValue: 10,
582
- // an output
583
- send: (value) => { ... }
584
- // a public property
585
- name: 'Tim'
586
- }
587
- })
588
- ` ` `
0 commit comments