Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated router link stub to match actual router-link interface #1840

Merged
merged 3 commits into from May 9, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/api/components/RouterLinkStub.md
Expand Up @@ -16,5 +16,5 @@ const wrapper = mount(Component, {
RouterLink: RouterLinkStub
}
})
expect(wrapper.find(RouterLinkStub).props().to).toBe('/some/path')
expect(wrapper.findComponent(RouterLinkStub).props().to).toBe('/some/path')
```
2 changes: 1 addition & 1 deletion docs/ja/api/components/RouterLinkStub.md
Expand Up @@ -16,5 +16,5 @@ const wrapper = mount(Component, {
RouterLink: RouterLinkStub
}
})
expect(wrapper.find(RouterLinkStub).props().to).toBe('/some/path')
expect(wrapper.findComponent(RouterLinkStub).props().to).toBe('/some/path')
```
2 changes: 1 addition & 1 deletion docs/ru/api/components/RouterLinkStub.md
Expand Up @@ -16,5 +16,5 @@ const wrapper = mount(Component, {
RouterLink: RouterLinkStub
}
})
expect(wrapper.find(RouterLinkStub).props().to).toBe('/some/path')
expect(wrapper.findComponent(RouterLinkStub).props().to).toBe('/some/path')
```
2 changes: 1 addition & 1 deletion docs/zh/api/components/RouterLinkStub.md
Expand Up @@ -16,5 +16,5 @@ const wrapper = mount(Component, {
RouterLink: RouterLinkStub
}
})
expect(wrapper.find(RouterLinkStub).props().to).toBe('/some/path')
expect(wrapper.findComponent(RouterLinkStub).props().to).toBe('/some/path')
```
2 changes: 2 additions & 0 deletions packages/test-utils/src/components/RouterLinkStub.js
Expand Up @@ -14,10 +14,12 @@ export default {
default: 'a'
},
exact: Boolean,
exactPath: Boolean,
append: Boolean,
replace: Boolean,
activeClass: String,
exactActiveClass: String,
exactPathActiveClass: String,
event: {
type: eventTypes,
default: 'click'
Expand Down
10 changes: 8 additions & 2 deletions test/specs/components/RouterLink.spec.js
Expand Up @@ -12,7 +12,9 @@ describeWithShallowAndMount('RouterLinkStub', mountingMethod => {
activeClass="activeClass1"
exactActiveClass="exactActiveClass1"
event="event1"
exact-path-active-class="exact-path-active-class"
exact
exact-path
append
replace
/>
Expand All @@ -25,14 +27,18 @@ describeWithShallowAndMount('RouterLinkStub', mountingMethod => {
}
})

const routerLink = wrapper.find(RouterLinkStub)
const routerLink = wrapper.getComponent(RouterLinkStub)
expect(routerLink.props().to).toEqual('to1')
expect(routerLink.props().tag).toEqual('a')
expect(routerLink.props().exact).toEqual(true)
expect(routerLink.props().exactPath).toEqual(true)
expect(routerLink.props().append).toEqual(true)
expect(routerLink.props().replace).toEqual(true)
expect(routerLink.props().activeClass).toEqual('activeClass1')
expect(routerLink.props().exactActiveClass).toEqual('exactActiveClass1')
expect(routerLink.props().exactPathActiveClass).toEqual(
'exact-path-active-class'
)
expect(routerLink.props().event).toEqual('event1')
})

Expand All @@ -49,6 +55,6 @@ describeWithShallowAndMount('RouterLinkStub', mountingMethod => {
RouterLink: RouterLinkStub
}
})
expect(wrapper.find(RouterLinkStub).text()).toEqual('some text')
expect(wrapper.getComponent(RouterLinkStub).text()).toEqual('some text')
})
})