IE compatibility and add unit tests

This commit is contained in:
Sylvain Brocard 2019-03-25 17:20:09 +01:00
commit ca8ae50717
3 changed files with 95 additions and 3 deletions

View file

@ -74,11 +74,11 @@ export class History {
if (local) {
const idIndex = currentRoute.indexOf('?')
path =
(idIndex > 0 ? currentRoute.substr(0, idIndex) : currentRoute) + path
(idIndex > 0 ? currentRoute.substring(0, idIndex) : currentRoute) + path
}
if (this.config.relativePath && !path.startsWith('/')) {
const currentDir = currentRoute.substr(0, currentRoute.lastIndexOf('/') + 1)
if (this.config.relativePath && path.indexOf('/') !== 0) {
const currentDir = currentRoute.substring(0, currentRoute.lastIndexOf('/') + 1)
return cleanPath(resolvePath(currentDir + path))
}
return cleanPath('/' + path)