Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit bea4fef

Browse files
committedApr 4, 2016
structure test for v-link delegate
1 parent b227648 commit bea4fef

File tree

1 file changed

+24
-29
lines changed

1 file changed

+24
-29
lines changed
 

‎test/unit/specs/core.js

Lines changed: 24 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -361,29 +361,6 @@ describe('Core', function () {
361361
})
362362
})
363363

364-
it('v-link delegation', function (done) {
365-
router = new Router({ abstract: true })
366-
router.map({
367-
'/a': {
368-
component: {
369-
template: 'hello'
370-
}
371-
}
372-
})
373-
router.start({
374-
replace: false,
375-
template:
376-
'<div v-link><a href="/a"><span id="link"></span></a></div>' +
377-
'<router-view></router-view>'
378-
}, el)
379-
var link = el.querySelector('#link')
380-
click(link)
381-
nextTick(function () {
382-
expect(el.textContent).toBe('hello')
383-
done()
384-
})
385-
})
386-
387364
it('v-link active classes', function (done) {
388365
router = new Router({
389366
abstract: true,
@@ -587,12 +564,7 @@ describe('Core', function () {
587564
el = router.app.$el
588565
router.go('/foo')
589566
nextTick(function () {
590-
var wrap = el.querySelector('#wrap')
591-
var e = document.createEvent('Events')
592-
e.initEvent('click', true, true)
593-
e.button = 0
594-
var target = wrap.querySelector('a')
595-
target.dispatchEvent(e)
567+
click(el.querySelector('#wrap a'))
596568
nextTick(function () {
597569
var text = router.app.$el.textContent
598570
expect(text).toBe('Home')
@@ -602,6 +574,29 @@ describe('Core', function () {
602574
})
603575
})
604576

577+
it('v-link delegate on non-anchor', function (done) {
578+
router = new Router({ abstract: true })
579+
router.map({
580+
'/a': {
581+
component: {
582+
template: 'hello'
583+
}
584+
}
585+
})
586+
router.start({
587+
replace: false,
588+
template:
589+
'<div v-link><a href="/a"><span id="link"></span></a></div>' +
590+
'<router-view></router-view>'
591+
}, el)
592+
var link = el.querySelector('#link')
593+
click(link)
594+
nextTick(function () {
595+
expect(el.textContent).toBe('hello')
596+
done()
597+
})
598+
})
599+
605600
it('alias', function (done) {
606601
router = new Router({ abstract: true })
607602
router.map({

0 commit comments

Comments
 (0)
Please sign in to comment.