File tree Expand file tree Collapse file tree 2 files changed +27
-15
lines changed
apps/example-app/src/app/examples Expand file tree Collapse file tree 2 files changed +27
-15
lines changed Original file line number Diff line number Diff line change 11import { render , screen } from '@testing-library/angular' ;
22import { SignalInputComponent } from './22-signal-inputs.component' ;
3- import { Component } from '@angular/core' ;
43
5- test ( 'works with signal inputs using a wrapper component' , async ( ) => {
6- @Component ( {
7- template : `
8- <app-signal-input [greeting]="greeting" [name]="name"/>
9- ` ,
10- standalone : true ,
11- imports : [ SignalInputComponent ] ,
12- } )
13- class WrapperComponent {
14- greeting = 'Hello' ;
15- name = 'world' ;
16- }
4+ test ( 'works with signal inputs' , async ( ) => {
5+ await render ( SignalInputComponent , {
6+ componentInputs : {
7+ name : 'world' ,
8+ greeting : 'Hello' ,
9+ } ,
10+ } ) ;
1711
18- await render ( WrapperComponent ) ;
12+ expect ( screen . getByText ( / h e l l o w o r l d / i) ) . toBeInTheDocument ( ) ;
13+ } ) ;
14+
15+ test ( 'works with signal inputs and rerenders' , async ( ) => {
16+ const view = await render ( SignalInputComponent , {
17+ componentInputs : {
18+ greeting : 'Hello' ,
19+ name : 'world' ,
20+ } ,
21+ } ) ;
1922
2023 expect ( screen . getByText ( / h e l l o w o r l d / i) ) . toBeInTheDocument ( ) ;
24+
25+ await view . rerender ( {
26+ componentInputs : {
27+ greeting : 'bye' ,
28+ name : 'test' ,
29+ } ,
30+ } ) ;
31+
32+ expect ( screen . getByText ( / b y e t e s t / i) ) . toBeInTheDocument ( ) ;
2133} ) ;
Original file line number Diff line number Diff line change 8383 "eslint-plugin-testing-library" : " ~5.0.1" ,
8484 "jasmine-core" : " 4.2.0" ,
8585 "jasmine-spec-reporter" : " 7.0.0" ,
86- "jest" : " 29.5 .0" ,
86+ "jest" : " 29.7 .0" ,
8787 "jest-environment-jsdom" : " 29.5.0" ,
8888 "jest-preset-angular" : " 14.0.3" ,
8989 "karma" : " 6.4.0" ,
You can’t perform that action at this time.
0 commit comments