|
1 |
| -test.todo('Your test suite must contain at least one test.') |
2 |
| -// import {render} from '@testing-library/vue' |
3 |
| -// import '@testing-library/jest-dom' |
4 |
| -// import FunctionalSFC from './components/FunctionalSFC' |
| 1 | +import {render} from '@testing-library/vue' |
| 2 | +import '@testing-library/jest-dom' |
| 3 | +import {h} from 'vue' |
5 | 4 |
|
6 |
| -// import {render} from '@testing-library/vue' |
7 |
| -// import FunctionalSFC from './components/FunctionalSFC' |
| 5 | +// From docs: Performance gains from 2.x for functional components are now |
| 6 | +// negligible in 3.x, so we recommend just using stateful components. |
8 | 7 |
|
9 |
| -// const Functional = { |
10 |
| -// functional: true, |
11 |
| -// render(createElement) { |
12 |
| -// return createElement('p', null, 'Hi!') |
13 |
| -// }, |
14 |
| -// } |
| 8 | +// eslint-disable-next-line no-unused-vars |
| 9 | +const Functional = (props, context) => { |
| 10 | + return h('div', {}, 'Hi!') |
| 11 | +} |
15 | 12 |
|
16 |
| -// test('renders functional component', () => { |
17 |
| -// const {getByText} = render(Functional) |
| 13 | +test('renders functional component', () => { |
| 14 | + const {getByText} = render(Functional) |
18 | 15 |
|
19 |
| -// expect(getByText('Hi!')).toBeInTheDocument() |
20 |
| -// }) |
21 |
| - |
22 |
| -// test('renders functional SFC component', () => { |
23 |
| -// const {getByText} = render(FunctionalSFC) |
24 |
| - |
25 |
| -// expect(getByText('Hi!')).toBeInTheDocument() |
26 |
| -// }) |
| 16 | + expect(getByText('Hi!')).toBeInTheDocument() |
| 17 | +}) |
0 commit comments