You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// @flow/* eslint-env jest */import{mount,createLocalVue,RouterLinkStub}from'@vue/test-utils'importVueRouterfrom'vue-router'importTestfrom'./Offices'constlocalVue=createLocalVue()localVue.use(VueRouter)describe('Test.js',()=>{it('should render with a stub',()=>expect(mount(Test,{
localVue,stubs: {'router-link': RouterLinkStub}}).element).toBeDefined())it('should render with the router',()=>{expect(mount(Test,{
localVue
}).element).toBeDefined()})})
What is expected?
In both test cases router-link in OfficeCard should be stubbed and tests should pass without errors.
What is actually happening?
Instead, the following error will be logged to the console for both cases:
[Vue warn]: Unknown custom element: <router-link> - did you register the component correctly? For recursive components, make sure to provide the "name" option.
The issue is definitely related to the vue-class-component since the following code will pass without errors:
Fixes#973Fixes#994Fixes#995
BREAKING CHANGE: The tag name rendered by snapshots will use the rendered component tag, rather than the registered component name
Uh oh!
There was an error while loading. Please reload this page.
Version
1.0.0-beta.25
Steps to reproduce
Component
Test.js
, which uses another component withrouter-link
inside:Given the following test:
What is expected?
In both test cases
router-link
inOfficeCard
should be stubbed and tests should pass without errors.What is actually happening?
Instead, the following error will be logged to the console for both cases:
The issue is definitely related to the
vue-class-component
since the following code will pass without errors:I assume it is because it directly extends
Vue
which preventstest-utils
from effectively stubbing underlying components.The text was updated successfully, but these errors were encountered: