From: Eduardo San Martin Morote Date: Fri, 24 Apr 2020 12:34:32 +0000 (+0200) Subject: test: fix failing test X-Git-Tag: v4.0.0-alpha.8~41 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c1f38b75e4edee4fc80219b3ee1f4cbefd722ac1;p=thirdparty%2Fvuejs%2Frouter.git test: fix failing test --- diff --git a/__tests__/router.spec.ts b/__tests__/router.spec.ts index d158937d..096be961 100644 --- a/__tests__/router.spec.ts +++ b/__tests__/router.spec.ts @@ -119,7 +119,7 @@ describe('Router', () => { query: {}, hash: '', }), - undefined + expect.anything() ) }) @@ -138,7 +138,7 @@ describe('Router', () => { query: {}, hash: '', }), - undefined + expect.anything() ) }) @@ -188,7 +188,7 @@ describe('Router', () => { query: {}, hash: '', }), - undefined + expect.anything() ) }) @@ -204,7 +204,7 @@ describe('Router', () => { query: {}, hash: '', }), - undefined + expect.anything() ) }) @@ -220,7 +220,7 @@ describe('Router', () => { query: {}, hash: '', }), - undefined + expect.anything() ) }) diff --git a/src/history/html5.ts b/src/history/html5.ts index bab3decc..bf523732 100644 --- a/src/history/html5.ts +++ b/src/history/html5.ts @@ -10,7 +10,10 @@ import { ValueContainer, normalizeBase, } from './common' -import { computeScrollPosition, ScrollToPosition } from '../utils/scroll' +import { + computeScrollPosition, + ScrollPositionCoordinates, +} from '../scrollBehavior' import { warn } from 'vue' import { stripBase } from '../utils/location' @@ -22,7 +25,7 @@ interface StateEntry extends HistoryState { forward: HistoryLocationNormalized | null position: number replaced: boolean - scroll: ScrollToPosition | null + scroll: Required | null | false } /** diff --git a/src/router.ts b/src/router.ts index 394f4bf0..72eb14bc 100644 --- a/src/router.ts +++ b/src/router.ts @@ -559,10 +559,12 @@ export function createRouter({ pendingLocation = toLocation const from = currentRoute.value - saveScrollPosition( - getScrollKey(from.fullPath, info.distance), - computeScrollPosition() - ) + if (isBrowser) { + saveScrollPosition( + getScrollKey(from.fullPath, info.distance), + computeScrollPosition() + ) + } let failure: NavigationFailure | void