]> git.ipfire.org Git - thirdparty/vuejs/router.git/commitdiff
fix(router-view): disable inheritAttrs
authorEduardo San Martin Morote <posva13@gmail.com>
Thu, 24 Dec 2020 09:51:04 +0000 (10:51 +0100)
committerEduardo San Martin Morote <posva13@gmail.com>
Thu, 24 Dec 2020 09:51:04 +0000 (10:51 +0100)
Fix #674

__tests__/RouterView.spec.ts
src/RouterView.ts

index 1803d7e9263e9649f38c22a9c846f9eb7a9461ba..83f3017bb65fa30931c85e4f4dba96a7de1ad25f 100644 (file)
@@ -293,6 +293,15 @@ describe('RouterView', () => {
     expect(wrapper.html()).toBe(`<div>id:foo;other:fixed</div>`)
   })
 
+  it('inherit attributes', async () => {
+    const { wrapper } = await factory(routes.withIdAndOther, {
+      'data-test': 'true',
+    })
+    expect(wrapper.html()).toBe(
+      `<div data-test="true">id:foo;other:fixed</div>`
+    )
+  })
+
   it('can pass a function as props', async () => {
     const { wrapper } = await factory(routes.withFnProps)
     expect(wrapper.html()).toBe(`<div>id:2;other:page</div>`)
index f491d4f155472b682520a5a924eeb234c7349d55..883476a006ee3b35dc4e30c48f2d7de0440059c6 100644 (file)
@@ -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<string>,