UNPKG

614 BJavaScriptView Raw
1import test from 'ava';
2import sinon from 'sinon';
3import {mount} from 'vuenit';
4import {createHOC} from '../dist';
5
6const Component = {
7 props : ['propA', 'propB'],
8 template: `<ul>
9 <li>{{propA}}</li>
10 <li>{{propB}}</li>
11 </ul>`
12};
13
14mount(Component);
15
16test('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});