Skip to content

Commit 6e18015

Browse files
committed
docs: update README example
1 parent 8caff29 commit 6e18015

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

README.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -117,20 +117,20 @@ export class CounterComponent {
117117
counter.component.spec.ts
118118

119119
```typescript
120-
import { render } from '@testing-library/angular';
120+
import { render, screen } from '@testing-library/angular';
121121
import CounterComponent from './counter.component.ts';
122122

123123
describe('Counter', () => {
124124
test('should render counter', async () => {
125-
const { getByText } = await render(CounterComponent, { componentProperties: { counter: 5 } });
125+
await render(CounterComponent, { componentProperties: { counter: 5 } });
126126

127-
expect(getByText('Current Count: 5'));
127+
expect(screen.getByText('Current Count: 5'));
128128
});
129129

130130
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 } });
132132

133-
click(getByText('+'));
133+
click(screen.getByText('+'));
134134

135135
expect(getByText('Current Count: 6'));
136136
});
@@ -194,6 +194,7 @@ Thanks goes to these people ([emoji key][emojis]):
194194

195195
<!-- markdownlint-enable -->
196196
<!-- prettier-ignore-end -->
197+
197198
<!-- ALL-CONTRIBUTORS-LIST:END -->
198199

199200
This project follows the [all-contributors][all-contributors] specification.

0 commit comments

Comments
 (0)