Skip to content

Commit

Permalink
revert: "fix(hash): correctly place query if placed before hash (#2851)"
Browse files Browse the repository at this point in the history
This reverts commit b7715dc.
Closes #2876
  • Loading branch information
posva committed Aug 8, 2019
1 parent e9ab7f3 commit 9b30e4c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 20 deletions.
11 changes: 3 additions & 8 deletions src/history/hash.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
12 changes: 0 additions & 12 deletions test/e2e/specs/hash-mode.js
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}
}

0 comments on commit 9b30e4c

Please sign in to comment.