@@ -117,20 +117,20 @@ export class CounterComponent {
117
117
counter.component.spec.ts
118
118
119
119
``` typescript
120
- import { render } from ' @testing-library/angular' ;
120
+ import { render , screen } from ' @testing-library/angular' ;
121
121
import CounterComponent from ' ./counter.component.ts' ;
122
122
123
123
describe (' Counter' , () => {
124
124
test (' should render counter' , async () => {
125
- const { getByText } = await render (CounterComponent , { componentProperties: { counter: 5 } });
125
+ await render (CounterComponent , { componentProperties: { counter: 5 } });
126
126
127
- expect (getByText (' Current Count: 5' ));
127
+ expect (screen . getByText (' Current Count: 5' ));
128
128
});
129
129
130
130
test (' should increment the counter on click' , async () => {
131
- const { getByText, click } = await render (CounterComponent , { componentProperties: { counter: 5 } });
131
+ const { click } = await render (CounterComponent , { componentProperties: { counter: 5 } });
132
132
133
- click (getByText (' +' ));
133
+ click (screen . getByText (' +' ));
134
134
135
135
expect (getByText (' Current Count: 6' ));
136
136
});
@@ -194,6 +194,7 @@ Thanks goes to these people ([emoji key][emojis]):
194
194
195
195
<!-- markdownlint-enable -->
196
196
<!-- prettier-ignore-end -->
197
+
197
198
<!-- ALL-CONTRIBUTORS-LIST:END -->
198
199
199
200
This project follows the [ all-contributors] [ all-contributors ] specification.
0 commit comments