diff --git a/src/history/hash.js b/src/history/hash.js index 210fae6a2..25a670fcb 100644 --- a/src/history/hash.js +++ b/src/history/hash.js @@ -135,14 +135,9 @@ export function getHash (): string { function getUrl (path) { const href = window.location.href - const hashPos = href.indexOf('#') - let base = hashPos > -1 ? href.slice(0, hashPos) : href - - const searchPos = base.indexOf('?') - const query = searchPos > -1 ? base.slice(searchPos) : '' - base = query ? base.slice(0, searchPos) : base - - return `${base}#${path + query}` + const i = href.indexOf('#') + const base = i >= 0 ? href.slice(0, i) : href + return `${base}#${path}` } function pushHash (path) { diff --git a/test/e2e/specs/hash-mode.js b/test/e2e/specs/hash-mode.js index 6ca546214..be5df7d14 100644 --- a/test/e2e/specs/hash-mode.js +++ b/test/e2e/specs/hash-mode.js @@ -57,18 +57,6 @@ module.exports = { .waitForElementVisible('#app', 1000) .assert.containsText('.view', 'unicode: ñ') .assert.containsText('#query-t', '%') - - // correctly placing query - // https://github.com/vuejs/vue-router/issues/2125 - .url('http://localhost:8080/hash-mode/?key=foo') - .waitForElementVisible('#app', 1000) - .assert.urlEquals('http://localhost:8080/hash-mode/#/?key=foo') - .url('http://localhost:8080/hash-mode?key=foo') - .waitForElementVisible('#app', 1000) - .assert.urlEquals('http://localhost:8080/hash-mode/#/?key=foo') - .url('http://localhost:8080/hash-mode?key=foo#other') - .waitForElementVisible('#app', 1000) - .assert.urlEquals('http://localhost:8080/hash-mode/#/other?key=foo') .end() } }