|
1 |
| -test.todo('Your test suite must contain at least one test.') |
| 1 | +import '@testing-library/jest-dom' |
| 2 | +import {render} from '@testing-library/vue' |
| 3 | +import Card from './components/Card' |
2 | 4 |
|
3 |
| -// import '@testing-library/jest-dom' |
4 |
| -// import {render} from '@testing-library/vue' |
5 |
| -// import Card from './components/Card' |
| 5 | +// Usage is the same as Vue Test Utils, since slots values are passed using the `slots` |
| 6 | +// key from mount(). For more, see: https://vue-test-utils.vuejs.org/api/options.html#slots |
| 7 | +test('Card component', () => { |
| 8 | + const {getByText} = render(Card, { |
| 9 | + slots: { |
| 10 | + header: '<h1>HEADER</h1>', |
| 11 | + footer: '<div>FOOTER</div>', |
| 12 | + }, |
| 13 | + }) |
6 | 14 |
|
7 |
| -// // In this test file we demo how to test a component with slots and a scoped slot. |
8 |
| - |
9 |
| -// // Usage is the same as Vue Test Utils, since slots and scopedSlots |
10 |
| -// // in the render options are directly passed through to the Utils mount(). |
11 |
| -// // For more, see: https://vue-test-utils.vuejs.org/api/options.html#slots |
12 |
| -// test('Card component', () => { |
13 |
| -// const {getByText, queryByText} = render(Card, { |
14 |
| -// slots: { |
15 |
| -// header: '<h1>HEADER</h1>', |
16 |
| -// footer: '<div>FOOTER</div>', |
17 |
| -// }, |
18 |
| -// scopedSlots: { |
19 |
| -// default: '<p>Yay! {{props.content}}</p>', |
20 |
| -// }, |
21 |
| -// }) |
22 |
| - |
23 |
| -// // The default slot should render the template above with the scoped prop "content". |
24 |
| -// expect(getByText('Yay! Scoped content!')).toBeInTheDocument() |
25 |
| - |
26 |
| -// // Instead of the default slot's fallback content. |
27 |
| -// expect( |
28 |
| -// queryByText('Nothing used the Scoped content!'), |
29 |
| -// ).not.toBeInTheDocument() |
30 |
| - |
31 |
| -// // And the header and footer slots should be rendered with the given templates. |
32 |
| -// expect(getByText('HEADER')).toBeInTheDocument() |
33 |
| -// expect(getByText('FOOTER')).toBeInTheDocument() |
34 |
| -// }) |
| 15 | + expect(getByText('HEADER')).toBeInTheDocument() |
| 16 | + expect(getByText('FOOTER')).toBeInTheDocument() |
| 17 | +}) |
0 commit comments