@@ -7,6 +7,62 @@ test('is possible to set input and listen for output', async () => {
77 const user = userEvent . setup ( ) ;
88 const sendValue = jest . fn ( ) ;
99
10+ await render ( InputOutputComponent , {
11+ componentInputs : {
12+ value : 47 ,
13+ } ,
14+ on : {
15+ sendValue,
16+ } ,
17+ } ) ;
18+
19+ const incrementControl = screen . getByRole ( 'button' , { name : / i n c r e m e n t / i } ) ;
20+ const sendControl = screen . getByRole ( 'button' , { name : / s e n d / i } ) ;
21+ const valueControl = screen . getByTestId ( 'value' ) ;
22+
23+ expect ( valueControl ) . toHaveTextContent ( '47' ) ;
24+
25+ await user . click ( incrementControl ) ;
26+ await user . click ( incrementControl ) ;
27+ await user . click ( incrementControl ) ;
28+ expect ( valueControl ) . toHaveTextContent ( '50' ) ;
29+
30+ await user . click ( sendControl ) ;
31+ expect ( sendValue ) . toHaveBeenCalledTimes ( 1 ) ;
32+ expect ( sendValue ) . toHaveBeenCalledWith ( 50 ) ;
33+ } ) ;
34+
35+ test . skip ( 'is possible to set input and listen for output with the template syntax' , async ( ) => {
36+ const user = userEvent . setup ( ) ;
37+ const sendSpy = jest . fn ( ) ;
38+
39+ await render ( '<app-fixture [value]="47" (sendValue)="sendValue($event)" />' , {
40+ imports : [ InputOutputComponent ] ,
41+ on : {
42+ sendValue : sendSpy ,
43+ } ,
44+ } ) ;
45+
46+ const incrementControl = screen . getByRole ( 'button' , { name : / i n c r e m e n t / i } ) ;
47+ const sendControl = screen . getByRole ( 'button' , { name : / s e n d / i } ) ;
48+ const valueControl = screen . getByTestId ( 'value' ) ;
49+
50+ expect ( valueControl ) . toHaveTextContent ( '47' ) ;
51+
52+ await user . click ( incrementControl ) ;
53+ await user . click ( incrementControl ) ;
54+ await user . click ( incrementControl ) ;
55+ expect ( valueControl ) . toHaveTextContent ( '50' ) ;
56+
57+ await user . click ( sendControl ) ;
58+ expect ( sendSpy ) . toHaveBeenCalledTimes ( 1 ) ;
59+ expect ( sendSpy ) . toHaveBeenCalledWith ( 50 ) ;
60+ } ) ;
61+
62+ test ( 'is possible to set input and listen for output (deprecated)' , async ( ) => {
63+ const user = userEvent . setup ( ) ;
64+ const sendValue = jest . fn ( ) ;
65+
1066 await render ( InputOutputComponent , {
1167 componentInputs : {
1268 value : 47 ,
@@ -34,7 +90,7 @@ test('is possible to set input and listen for output', async () => {
3490 expect ( sendValue ) . toHaveBeenCalledWith ( 50 ) ;
3591} ) ;
3692
37- test ( 'is possible to set input and listen for output with the template syntax' , async ( ) => {
93+ test ( 'is possible to set input and listen for output with the template syntax (deprecated) ' , async ( ) => {
3894 const user = userEvent . setup ( ) ;
3995 const sendSpy = jest . fn ( ) ;
4096
0 commit comments