|
1 |
| -test.todo('Your test suite must contain at least one test.') |
| 1 | +import {render} from '@testing-library/vue' |
| 2 | +import '@testing-library/jest-dom' |
| 3 | +import {uppercaseDirective} from './directives/uppercase-directive' |
| 4 | +import ComponentUsingDirective from './components/Directive' |
2 | 5 |
|
3 |
| -// import {render} from '@testing-library/vue' |
4 |
| -// import '@testing-library/jest-dom' |
5 |
| -// import {uppercaseDirective} from './directives/uppercase-directive' |
6 |
| -// import Directive from './components/Directive' |
| 6 | +test('Component with a custom directive', () => { |
| 7 | + const {queryByText, getByText} = render(ComponentUsingDirective, { |
| 8 | + global: { |
| 9 | + directives: {uppercase: uppercaseDirective}, |
| 10 | + }, |
| 11 | + }) |
7 | 12 |
|
8 |
| -// test('Component with a custom directive', () => { |
9 |
| -// // Do not forget to add the new custom directive to the render function as |
10 |
| -// // the third parameter. |
11 |
| -// const {queryByText, getByText} = render(Directive, {}, vue => |
12 |
| -// vue.directive('uppercase', uppercaseDirective), |
13 |
| -// ) |
| 13 | + // Test that the text in lower case does not appear in the DOM |
| 14 | + expect(queryByText('example text')).not.toBeInTheDocument() |
14 | 15 |
|
15 |
| -// // Test that the text in lower case does not appear in the DOM |
16 |
| -// expect(queryByText('example text')).not.toBeInTheDocument() |
17 |
| - |
18 |
| -// // Test that the text in upper case does appear in the DOM thanks to the directive |
19 |
| -// expect(getByText('EXAMPLE TEXT')).toBeInTheDocument() |
20 |
| -// }) |
| 16 | + // Test that the text in upper case does appear in the DOM thanks to the directive |
| 17 | + expect(getByText('EXAMPLE TEXT')).toBeInTheDocument() |
| 18 | +}) |
0 commit comments