From: Eduardo San Martin Morote Date: Thu, 24 Dec 2020 09:51:04 +0000 (+0100) Subject: fix(router-view): disable inheritAttrs X-Git-Tag: v4.0.2~8 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1e58574e6175f591f7fb24bcfc6e11045e7b0148;p=thirdparty%2Fvuejs%2Frouter.git fix(router-view): disable inheritAttrs Fix #674 --- diff --git a/__tests__/RouterView.spec.ts b/__tests__/RouterView.spec.ts index 1803d7e9..83f3017b 100644 --- a/__tests__/RouterView.spec.ts +++ b/__tests__/RouterView.spec.ts @@ -293,6 +293,15 @@ describe('RouterView', () => { expect(wrapper.html()).toBe(`
id:foo;other:fixed
`) }) + it('inherit attributes', async () => { + const { wrapper } = await factory(routes.withIdAndOther, { + 'data-test': 'true', + }) + expect(wrapper.html()).toBe( + `
id:foo;other:fixed
` + ) + }) + it('can pass a function as props', async () => { const { wrapper } = await factory(routes.withFnProps) expect(wrapper.html()).toBe(`
id:2;other:page
`) diff --git a/src/RouterView.ts b/src/RouterView.ts index f491d4f1..883476a0 100644 --- a/src/RouterView.ts +++ b/src/RouterView.ts @@ -36,6 +36,8 @@ export interface RouterViewProps { export const RouterViewImpl = /*#__PURE__*/ defineComponent({ name: 'RouterView', + // #674 we manually inherit them + inheritAttrs: false, props: { name: { type: String as PropType,