Skip to content

Commit e9a456a

Browse files
test: fix tests
1 parent ab4b770 commit e9a456a

File tree

3 files changed

+7
-14
lines changed

3 files changed

+7
-14
lines changed

.babelrc

+1-8
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,7 @@
1010
"env": {
1111
"test": {
1212
"presets": [
13-
[
14-
"@babel/preset-env",
15-
{
16-
"targets": {
17-
"node": 8
18-
}
19-
}
20-
]
13+
"@babel/preset-env"
2114
]
2215
}
2316
}

lib/index.js

+5-3
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ const isExternal = props => !props.to ||
3434

3535
const vueLinkFactory = (slashes, isNuxt) => ({
3636
functional: true,
37-
render: (h, { data, children, props }) => {
37+
render: (h, { data, slots, props }) => {
3838
data.props = props
3939
data.props.slashes = data.props.slashes || slashes
4040

@@ -46,6 +46,8 @@ const vueLinkFactory = (slashes, isNuxt) => ({
4646

4747
const linkComponent = isNuxt ? 'NuxtLink' : 'RouterLink'
4848

49+
const defaultSlots = slots().default
50+
4951
return isLinkedToExternal
5052
? h('a', {
5153
...data,
@@ -55,8 +57,8 @@ const vueLinkFactory = (slashes, isNuxt) => ({
5557
rel: data.props.rel || 'noopener',
5658
target: data.props.target || (data.props.newTab ? '_blank' : undefined)
5759
}
58-
}, children)
59-
: h(linkComponent, data, children)
60+
}, defaultSlots)
61+
: h(linkComponent, data, defaultSlots)
6062
}
6163
})
6264

test/__snapshots__/VueLink.spec.js.snap

+1-3
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,7 @@ exports[`ForNuxt nuxt-link does apply custom props 1`] = `
66
</a>
77
`;
88

9-
exports[`VueLink external does bind class 1`] = `<a rel="noopener" class="static"><template></template></a>`;
10-
11-
exports[`VueLink external does bind classp 1`] = `
9+
exports[`VueLink external does bind class 1`] = `
1210
<a rel="noopener" class="static">
1311
<div>Hi</div>
1412
</a>

0 commit comments

Comments
 (0)