]> git.ipfire.org Git - thirdparty/vuejs/router.git/commitdiff
test: fix failing test
authorEduardo San Martin Morote <posva13@gmail.com>
Fri, 24 Apr 2020 12:34:32 +0000 (14:34 +0200)
committerEduardo San Martin Morote <posva13@gmail.com>
Fri, 24 Apr 2020 12:34:32 +0000 (14:34 +0200)
__tests__/router.spec.ts
src/history/html5.ts
src/router.ts

index d158937d4bcec02270884b1320f31ac0a8a17bac..096be9618f8fa0cfc991b0f7ebc462080784f686 100644 (file)
@@ -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()
     )
   })
 
index bab3decc83df2ca1401c4282a215fdfad424b396..bf523732f1cfebd7b5e25147031a8b81dc51b94b 100644 (file)
@@ -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<ScrollPositionCoordinates> | null | false
 }
 
 /**
index 394f4bf03fbb59e81660b1f2f69783770fb95ddc..72eb14bc8be39852e3ca1e16071a6afb1e85783e 100644 (file)
@@ -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