From 1e58574e6175f591f7fb24bcfc6e11045e7b0148 Mon Sep 17 00:00:00 2001 From: Eduardo San Martin Morote Date: Thu, 24 Dec 2020 10:51:04 +0100 Subject: [PATCH] fix(router-view): disable inheritAttrs Fix #674 --- __tests__/RouterView.spec.ts | 9 +++++++++ src/RouterView.ts | 2 ++ 2 files changed, 11 insertions(+) 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, -- 2.47.3