Skip to content

Commit d325540

Browse files
committed
Fix functional tests
1 parent ab0f94e commit d325540

File tree

1 file changed

+13
-22
lines changed

1 file changed

+13
-22
lines changed

src/__tests__/functional.js

+13-22
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,17 @@
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'
54

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.
87

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+
}
1512

16-
// test('renders functional component', () => {
17-
// const {getByText} = render(Functional)
13+
test('renders functional component', () => {
14+
const {getByText} = render(Functional)
1815

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

Comments
 (0)