Skip to content

Commit 2edc211

Browse files
committed
fix html5 history unit test
1 parent 6a25023 commit 2edc211

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

test/unit/specs/history/html5.js

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,15 @@ if (!isIE9) {
55

66
var url = location.href
77
var pathname = location.pathname
8+
var history
89
afterEach(function (done) {
9-
history.replaceState({}, '', url)
10+
history.stop()
11+
window.history.replaceState({}, '', url)
1012
setTimeout(done, 0)
1113
})
1214

1315
it('notify change', function (done) {
14-
var history = new History({
16+
history = new History({
1517
onChange: step1
1618
})
1719
history.start()
@@ -39,7 +41,7 @@ if (!isIE9) {
3941
})
4042

4143
it('root option', function (done) {
42-
var history = new History({
44+
history = new History({
4345
onChange: step1,
4446
root: 'root/'
4547
})
@@ -56,8 +58,8 @@ if (!isIE9) {
5658
}
5759
})
5860

59-
it('popstate with root', function () {
60-
var history = new History({
61+
it('popstate with root', function (done) {
62+
history = new History({
6163
onChange: step1,
6264
root: 'root/'
6365
})
@@ -90,7 +92,7 @@ if (!isIE9) {
9092
var base = document.createElement('base')
9193
base.setAttribute('href', '/base/')
9294
document.head.appendChild(base)
93-
var history = new History({
95+
history = new History({
9496
onChange: step1
9597
})
9698
history.start()

0 commit comments

Comments
 (0)