@@ -7,42 +7,45 @@ test('works with signal inputs', async () => {
77 inputs : {
88 ...aliasedInput ( 'greeting' , 'Hello' ) ,
99 name : 'world' ,
10+ age : '45' ,
1011 } ,
1112 } ) ;
1213
1314 const inputValue = within ( screen . getByTestId ( 'input-value' ) ) ;
14- expect ( inputValue . getByText ( / h e l l o w o r l d / i) ) . toBeInTheDocument ( ) ;
15+ expect ( inputValue . getByText ( / h e l l o w o r l d o f 4 5 y e a r s o l d / i) ) . toBeInTheDocument ( ) ;
1516} ) ;
1617
1718test ( 'works with computed' , async ( ) => {
1819 await render ( SignalInputComponent , {
1920 inputs : {
2021 ...aliasedInput ( 'greeting' , 'Hello' ) ,
2122 name : 'world' ,
23+ age : '45' ,
2224 } ,
2325 } ) ;
2426
2527 const computedValue = within ( screen . getByTestId ( 'computed-value' ) ) ;
26- expect ( computedValue . getByText ( / h e l l o w o r l d / i) ) . toBeInTheDocument ( ) ;
28+ expect ( computedValue . getByText ( / h e l l o w o r l d o f 4 5 y e a r s o l d / i) ) . toBeInTheDocument ( ) ;
2729} ) ;
2830
2931test ( 'can update signal inputs' , async ( ) => {
3032 const { fixture } = await render ( SignalInputComponent , {
3133 inputs : {
3234 ...aliasedInput ( 'greeting' , 'Hello' ) ,
3335 name : 'world' ,
36+ age : '45' ,
3437 } ,
3538 } ) ;
3639
3740 const inputValue = within ( screen . getByTestId ( 'input-value' ) ) ;
3841 const computedValue = within ( screen . getByTestId ( 'computed-value' ) ) ;
3942
40- expect ( inputValue . getByText ( / h e l l o w o r l d / i) ) . toBeInTheDocument ( ) ;
43+ expect ( inputValue . getByText ( / h e l l o w o r l d o f 4 5 y e a r s o l d / i) ) . toBeInTheDocument ( ) ;
4144
4245 fixture . componentInstance . name . set ( 'updated' ) ;
4346 // set doesn't trigger change detection within the test, findBy is needed to update the template
44- expect ( await inputValue . findByText ( / h e l l o u p d a t e d / i) ) . toBeInTheDocument ( ) ;
45- expect ( await computedValue . findByText ( / h e l l o u p d a t e d / i) ) . toBeInTheDocument ( ) ;
47+ expect ( await inputValue . findByText ( / h e l l o u p d a t e d o f 4 5 y e a r s o l d / i) ) . toBeInTheDocument ( ) ;
48+ expect ( await computedValue . findByText ( / h e l l o u p d a t e d o f 4 5 y e a r s o l d / i) ) . toBeInTheDocument ( ) ;
4649
4750 // it's not recommended to access the model directly, but it's possible
4851 expect ( fixture . componentInstance . name ( ) ) . toBe ( 'updated' ) ;
@@ -54,6 +57,7 @@ test('output emits a value', async () => {
5457 inputs : {
5558 ...aliasedInput ( 'greeting' , 'Hello' ) ,
5659 name : 'world' ,
60+ age : '45' ,
5761 } ,
5862 on : {
5963 submit : submitFn ,
@@ -70,6 +74,7 @@ test('model update also updates the template', async () => {
7074 inputs : {
7175 ...aliasedInput ( 'greeting' , 'Hello' ) ,
7276 name : 'initial' ,
77+ age : '45' ,
7378 } ,
7479 } ) ;
7580
@@ -100,22 +105,24 @@ test('works with signal inputs, computed values, and rerenders', async () => {
100105 inputs : {
101106 ...aliasedInput ( 'greeting' , 'Hello' ) ,
102107 name : 'world' ,
108+ age : '45' ,
103109 } ,
104110 } ) ;
105111
106112 const inputValue = within ( screen . getByTestId ( 'input-value' ) ) ;
107113 const computedValue = within ( screen . getByTestId ( 'computed-value' ) ) ;
108114
109- expect ( inputValue . getByText ( / h e l l o w o r l d / i) ) . toBeInTheDocument ( ) ;
110- expect ( computedValue . getByText ( / h e l l o w o r l d / i) ) . toBeInTheDocument ( ) ;
115+ expect ( inputValue . getByText ( / h e l l o w o r l d o f 4 5 y e a r s o l d / i) ) . toBeInTheDocument ( ) ;
116+ expect ( computedValue . getByText ( / h e l l o w o r l d o f 4 5 y e a r s o l d / i) ) . toBeInTheDocument ( ) ;
111117
112118 await view . rerender ( {
113119 inputs : {
114120 ...aliasedInput ( 'greeting' , 'bye' ) ,
115121 name : 'test' ,
122+ age : '0' ,
116123 } ,
117124 } ) ;
118125
119- expect ( inputValue . getByText ( / b y e t e s t / i) ) . toBeInTheDocument ( ) ;
120- expect ( computedValue . getByText ( / b y e t e s t / i) ) . toBeInTheDocument ( ) ;
126+ expect ( inputValue . getByText ( / b y e t e s t o f 0 y e a r s o l d / i) ) . toBeInTheDocument ( ) ;
127+ expect ( computedValue . getByText ( / b y e t e s t o f 0 y e a r s o l d / i) ) . toBeInTheDocument ( ) ;
121128} ) ;
0 commit comments