Skip to content

Commit 9b30e4c

Browse files
committedAug 8, 2019
revert: "fix(hash): correctly place query if placed before hash (#2851)"
This reverts commit b7715dc. Closes #2876
1 parent e9ab7f3 commit 9b30e4c

File tree

2 files changed

+3
-20
lines changed

2 files changed

+3
-20
lines changed
 

‎src/history/hash.js

+3-8
Original file line numberDiff line numberDiff line change
@@ -135,14 +135,9 @@ export function getHash (): string {
135135

136136
function getUrl (path) {
137137
const href = window.location.href
138-
const hashPos = href.indexOf('#')
139-
let base = hashPos > -1 ? href.slice(0, hashPos) : href
140-
141-
const searchPos = base.indexOf('?')
142-
const query = searchPos > -1 ? base.slice(searchPos) : ''
143-
base = query ? base.slice(0, searchPos) : base
144-
145-
return `${base}#${path + query}`
138+
const i = href.indexOf('#')
139+
const base = i >= 0 ? href.slice(0, i) : href
140+
return `${base}#${path}`
146141
}
147142

148143
function pushHash (path) {

‎test/e2e/specs/hash-mode.js

-12
Original file line numberDiff line numberDiff line change
@@ -57,18 +57,6 @@ module.exports = {
5757
.waitForElementVisible('#app', 1000)
5858
.assert.containsText('.view', 'unicode: ñ')
5959
.assert.containsText('#query-t', '%')
60-
61-
// correctly placing query
62-
// https://github.com/vuejs/vue-router/issues/2125
63-
.url('http://localhost:8080/hash-mode/?key=foo')
64-
.waitForElementVisible('#app', 1000)
65-
.assert.urlEquals('http://localhost:8080/hash-mode/#/?key=foo')
66-
.url('http://localhost:8080/hash-mode?key=foo')
67-
.waitForElementVisible('#app', 1000)
68-
.assert.urlEquals('http://localhost:8080/hash-mode/#/?key=foo')
69-
.url('http://localhost:8080/hash-mode?key=foo#other')
70-
.waitForElementVisible('#app', 1000)
71-
.assert.urlEquals('http://localhost:8080/hash-mode/#/other?key=foo')
7260
.end()
7361
}
7462
}

0 commit comments

Comments
 (0)