Skip to content

Commit

Permalink
fix(router-view): disable inheritAttrs
Browse files Browse the repository at this point in the history
Fix #674
  • Loading branch information
posva committed Dec 24, 2020
1 parent 034c71c commit 1e58574
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
9 changes: 9 additions & 0 deletions __tests__/RouterView.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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>`)
Expand Down
2 changes: 2 additions & 0 deletions src/RouterView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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>,
Expand Down

0 comments on commit 1e58574

Please sign in to comment.