feat(): initial vue support

This commit is contained in:
Modus Create
2018-10-10 17:04:33 -04:00
committed by Mike Hartington
parent a9b30646fe
commit 73cff0c61a
36 changed files with 9914 additions and 0 deletions

45
vue/test/router.spec.js Normal file
View File

@ -0,0 +1,45 @@
import Vue from 'vue'
import Router from '../src/router.js'
describe('Router', () => {
it('Installs correctly', () => {
Vue.use(Router)
const app = new Vue({
router: new Router(),
})
expect(typeof app.$router).toBe('object')
expect(typeof app.$options.components.IonVueRouter).toBe('function')
expect(Router.install()).toBeFalsy()
})
it('Navigates correctly', () => {
const r = new Router({ mode: 'abstract' })
r.push('/')
expect(r.viewCount).toBe(1)
expect(r.direction).toBe(1)
expect(r.canGoBack()).toBeFalsy()
r.push('/foo')
expect(r.viewCount).toBe(2)
expect(r.direction).toBe(1)
expect(r.canGoBack()).toBeTruthy()
r.push('/bar')
expect(r.viewCount).toBe(3)
expect(r.direction).toBe(1)
expect(r.canGoBack()).toBeTruthy()
r.go(-1)
expect(r.viewCount).toBe(2)
expect(r.direction).toBe(-1)
expect(r.canGoBack()).toBeTruthy()
r.go(-1)
expect(r.viewCount).toBe(1)
expect(r.direction).toBe(-1)
expect(r.canGoBack()).toBeFalsy()
})
})