Vēsture Neapstrādāts
    //设置 mui.ready(function() { /*定义全局变量*/ var removeId = document.getElementById("removeid"); var security = document.getElementById("security"); var userAgreement = document.getElementById("userAgreement"); var about = document.getElementById("about"); var kefu = document.getElementById("kefu"); /*账户与安全*/ security.addEventListener('tap',function(){ plus.nativeUI.showWaiting();//显示原生等待框 webviewShow = plus.webview.create("../html/security.html","../html/security.html"); }); /*关于科袖*/ about.addEventListener('tap',function(){ mui.openWindow({ url: '../html/aboutus.html', id: '../html/aboutus.html', show: { aniShow: "slide-in-right" } }); }); /*用户协议*/ userAgreement.addEventListener('tap',function(){ mui.openWindow({ url: '../html/privacy.html', id: '../html/privacy.html', show: { aniShow: "slide-in-right" } }); }); /*退出按钮*/ removeId.addEventListener('tap', function() { var btn = ["退出", "取消"]; mui.confirm("是否退出", "提示", btn, function(e) { if(e.index == 0) { plus.storage.removeItem("userid"); console.log('点击退出时id=='+plus.storage.getItem('userid')); //plus.cache.clear(); //plus.storage.clear(); var userId = "null"; mui.currentWebview.close(); mui.back(); var myaccountPage = plus.webview.getWebviewById('html/myaccount.html'); mui.fire(myaccountPage, 'closeUser', { id: userId }); var consultPage = plus.webview.getWebviewById('consultlist.html'); mui.fire(consultPage, 'exited', { id: userId }); } }); }); /*客服帮助*/ kefu.addEventListener('tap',function(){ mui.openWindow({ url: '../html/kefuhelp.html', id: '../html/kefuhelp.html', show: { aniShow: "slide-in-right" } }); }); });
ecorr - Gogs: Go Git Service

暫無描述

Breadcrumb.spec.js 2.6KB

    import { mount, createLocalVue } from '@vue/test-utils' import VueRouter from 'vue-router' import ElementUI from 'element-ui' import Breadcrumb from '@/components/Breadcrumb/index.vue' const localVue = createLocalVue() localVue.use(VueRouter) localVue.use(ElementUI) const routes = [ { path: '/', name: 'home', children: [{ path: 'dashboard', name: 'dashboard' }] }, { path: '/menu', name: 'menu', children: [{ path: 'menu1', name: 'menu1', meta: { title: 'menu1' }, children: [{ path: 'menu1-1', name: 'menu1-1', meta: { title: 'menu1-1' } }, { path: 'menu1-2', name: 'menu1-2', redirect: 'noredirect', meta: { title: 'menu1-2' }, children: [{ path: 'menu1-2-1', name: 'menu1-2-1', meta: { title: 'menu1-2-1' } }, { path: 'menu1-2-2', name: 'menu1-2-2' }] }] }] }] const router = new VueRouter({ routes }) describe('Breadcrumb.vue', () => { const wrapper = mount(Breadcrumb, { localVue, router }) it('dashboard', () => { router.push('/dashboard') const len = wrapper.findAll('.el-breadcrumb__inner').length expect(len).toBe(1) }) it('normal route', () => { router.push('/menu/menu1') const len = wrapper.findAll('.el-breadcrumb__inner').length expect(len).toBe(2) }) it('nested route', () => { router.push('/menu/menu1/menu1-2/menu1-2-1') const len = wrapper.findAll('.el-breadcrumb__inner').length expect(len).toBe(4) }) it('no meta.title', () => { router.push('/menu/menu1/menu1-2/menu1-2-2') const len = wrapper.findAll('.el-breadcrumb__inner').length expect(len).toBe(3) }) // it('click link', () => { // router.push('/menu/menu1/menu1-2/menu1-2-2') // const breadcrumbArray = wrapper.findAll('.el-breadcrumb__inner') // const second = breadcrumbArray.at(1) // console.log(breadcrumbArray) // const href = second.find('a').attributes().href // expect(href).toBe('#/menu/menu1') // }) // it('noRedirect', () => { // router.push('/menu/menu1/menu1-2/menu1-2-1') // const breadcrumbArray = wrapper.findAll('.el-breadcrumb__inner') // const redirectBreadcrumb = breadcrumbArray.at(2) // expect(redirectBreadcrumb.contains('a')).toBe(false) // }) it('last breadcrumb', () => { router.push('/menu/menu1/menu1-2/menu1-2-1') const breadcrumbArray = wrapper.findAll('.el-breadcrumb__inner') const redirectBreadcrumb = breadcrumbArray.at(3) expect(redirectBreadcrumb.contains('a')).toBe(false) }) })
Sign In - Gogs: Go Git Service

Sign In