diff options
author | Alexander Tseung <alextsg@gmail.com> | 2018-04-05 09:21:30 +0800 |
---|---|---|
committer | Alexander Tseung <alextsg@gmail.com> | 2018-04-05 09:21:30 +0800 |
commit | 037d6e66248d2fc13a9d97a52ce667afe1aa2ae8 (patch) | |
tree | 60e33e1105cd0c93aef0ffa19e29c0e3ba51f2c3 /development/mock-dev.js | |
parent | 7776af7cd059499f34eea3408b323fd6b73fd05e (diff) | |
download | tangerine-wallet-browser-037d6e66248d2fc13a9d97a52ce667afe1aa2ae8.tar tangerine-wallet-browser-037d6e66248d2fc13a9d97a52ce667afe1aa2ae8.tar.gz tangerine-wallet-browser-037d6e66248d2fc13a9d97a52ce667afe1aa2ae8.tar.bz2 tangerine-wallet-browser-037d6e66248d2fc13a9d97a52ce667afe1aa2ae8.tar.lz tangerine-wallet-browser-037d6e66248d2fc13a9d97a52ce667afe1aa2ae8.tar.xz tangerine-wallet-browser-037d6e66248d2fc13a9d97a52ce667afe1aa2ae8.tar.zst tangerine-wallet-browser-037d6e66248d2fc13a9d97a52ce667afe1aa2ae8.zip |
Fix integration tests
Diffstat (limited to 'development/mock-dev.js')
-rw-r--r-- | development/mock-dev.js | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/development/mock-dev.js b/development/mock-dev.js index a1fb3a86d..f332633d5 100644 --- a/development/mock-dev.js +++ b/development/mock-dev.js @@ -36,15 +36,28 @@ log.setLevel('debug') // const qs = require('qs') -let queryString = qs.parse(window.location.href.split('#')[1]) -let selectedView = queryString.view || 'first time' +const routerPath = window.location.href.split('#')[1] +let queryString = {} +let selectedView + +if (routerPath) { + queryString = qs.parse(routerPath.split('?')[1]) +} + +selectedView = queryString.view || 'first time' const firstState = states[selectedView] updateQueryParams(selectedView) -function updateQueryParams(newView) { +function updateQueryParams (newView) { queryString.view = newView const params = qs.stringify(queryString) - window.location.href = window.location.href.split('#')[0] + `#${params}` + const locationPaths = window.location.href.split('#') + const routerPath = locationPaths[1] || '' + const newPath = locationPaths[0] + '#' + routerPath.split('?')[0] + `?${params}` + + if (window.location.href !== newPath) { + window.location.href = newPath + } } // |