mirror of
https://github.com/wahyd4/vuepress.git
synced 2026-08-28 14:45:51 +10:00
1. Refine ExtendPageDataOption, simplify the implmentation 2. Introduce LayoutDistributor as the unique route layout entry 3. Inject layout components to LayoutDistributor 4. Register layout components located at themedir/layouts 5. Reorganize the default theme's structure
35 lines
843 B
JavaScript
35 lines
843 B
JavaScript
import { mount, RouterLinkStub } from '@vue/test-utils'
|
|
import modeTestRunner from '@vuepress/test-utils/modeTestRunner'
|
|
import NavLink from '../../components/NavLink.vue'
|
|
|
|
function test (mode, localVue) {
|
|
it(`$${mode} - renders nav link with internal link`, () => {
|
|
const item = {
|
|
link: '/',
|
|
text: 'VuePress'
|
|
}
|
|
const wrapper = mount(NavLink, {
|
|
localVue,
|
|
stubs: {
|
|
'router-link': RouterLinkStub
|
|
},
|
|
propsData: { item }
|
|
})
|
|
expect(wrapper.html()).toMatchSnapshot()
|
|
})
|
|
|
|
it(`$${mode} - renders nav link with external link`, () => {
|
|
const item = {
|
|
link: 'http://vuejs.org/',
|
|
text: 'Vue'
|
|
}
|
|
const wrapper = mount(NavLink, {
|
|
localVue,
|
|
propsData: { item }
|
|
})
|
|
expect(wrapper.html()).toMatchSnapshot()
|
|
})
|
|
}
|
|
|
|
modeTestRunner('NavLink', test)
|