2
0
mirror of https://github.com/tenrok/vue-meta.git synced 2026-06-18 20:50:33 +03:00

fix: afterNavigation logic (its never set in options)

This commit is contained in:
pimlie
2019-03-10 11:57:25 +01:00
committed by Alexander Lichter
parent 419951c59f
commit 4a8f9753e0
4 changed files with 40 additions and 56 deletions
-25
View File
@@ -6,8 +6,6 @@ import setOptions from '../../src/shared/options'
import { hasGlobalWindowFn } from '../../src/shared/window'
import { defaultOptions } from '../../src/shared/constants'
const noop = () => {}
describe('shared', () => {
test('ensureIsArray ensures var is array', () => {
let a = { p: 1 }
@@ -38,27 +36,4 @@ describe('shared', () => {
expect(options.contentKeyName).toBeDefined()
expect(options.contentKeyName).toBe(defaultOptions.contentKeyName)
})
test('setOptions warns when afterNavigation not fn', () => {
const warn = jest.spyOn(console, 'warn').mockImplementation(noop)
let options = { afterNavigation: true }
options = setOptions(options)
expect(warn).toHaveBeenCalledTimes(1)
expect(options.afterNavigation).toBeUndefined()
warn.mockRestore()
})
test('setOptions sets refreshOnceOnNavigation when afterNavigation defined', () => {
const warn = jest.spyOn(console, 'warn').mockImplementation(noop)
let options = { afterNavigation: noop }
options = setOptions(options)
expect(warn).not.toHaveBeenCalled()
expect(options.refreshOnceOnNavigation).toBe(true)
warn.mockRestore()
})
})