Skip to content

Commit f7ee0c3

Browse files
fix: correctly apply classes again
1 parent bd57899 commit f7ee0c3

File tree

3 files changed

+27
-0
lines changed

3 files changed

+27
-0
lines changed

lib/index.js

+1
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ const vueLinkFactory = slashes => ({
4646

4747
return isLinkedToExternal
4848
? h('a', {
49+
...data,
4950
attrs: {
5051
...data.attrs,
5152
href: data.props.to || undefined,

test/VueLink.spec.js

+20
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,26 @@ describe('VueLink', () => {
260260
expect(wrapper.isVueInstance()).toBe(false)
261261
expect(wrapper.contains(RouterLinkStub)).toBe(false)
262262

263+
expect(wrapper.html()).toMatchSnapshot()
264+
})
265+
it('does bind classp', () => {
266+
const wrapper = mount(VueLink, {
267+
localVue,
268+
attachToDocument: true,
269+
stubs: {
270+
RouterLink: RouterLinkStub
271+
},
272+
context: {
273+
staticClass: 'static'
274+
},
275+
slots: {
276+
default: '<div>Hi</div>'
277+
}
278+
})
279+
280+
expect(wrapper.isVueInstance()).toBe(false)
281+
expect(wrapper.contains(RouterLinkStub)).toBe(false)
282+
263283
expect(wrapper.html()).toMatchSnapshot()
264284
})
265285
})

test/__snapshots__/VueLink.spec.js.snap

+6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
// Jest Snapshot v1, https://goo.gl/fbAQLP
22

3+
exports[`VueLink external does bind classp 1`] = `
4+
<a rel="noopener" class="static">
5+
<div>Hi</div>
6+
</a>
7+
`;
8+
39
exports[`VueLink external does bind custom prop 1`] = `
410
<a title="ABC" rel="noopener">
511
<div>Hi</div>

0 commit comments

Comments
 (0)