1 | import test from 'ava';
|
2 | import sinon from 'sinon';
|
3 | import {mount} from 'vuenit';
|
4 | import {createHOC} from '../dist';
|
5 |
|
6 | const Component = {
|
7 | props : ['propA', 'propB'],
|
8 | template: `<ul>
|
9 | <li>{{propA}}</li>
|
10 | <li>{{propB}}</li>
|
11 | </ul>`
|
12 | };
|
13 |
|
14 | mount(Component);
|
15 |
|
16 | test('can be a functional component', t => {
|
17 | const enhanced = createHOC(Component, {
|
18 | functional: true
|
19 | }, {
|
20 | props: {
|
21 | propB: 'baz'
|
22 | }
|
23 | });
|
24 | const vm = mount(enhanced, {
|
25 | props: {
|
26 | propA: 'foo',
|
27 | propB: 'bah'
|
28 | }
|
29 | });
|
30 |
|
31 | const list = vm.$find('li');
|
32 |
|
33 | t.is(list[0].$text, 'foo');
|
34 | t.is(list[1].$text, 'baz');
|
35 | });
|