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

feat: add basic support for multiple apps on one page (#373)

* feat: add an appId to tags to support multiple apps

* feat: show warning on calling () on non-vuemeta components

* feat: always use appId ssr for server-generated apps

* test: update tests for appId

* chore: update circleci to only run audit for dependencies

* fix: dont set data-vue-meta attribute on title

it has no use on the client as we use document.title there. Which also means the appId listed would be wrong once the title is updated by another app then the ssr app

* chore: remove unused import

* chore: improve not supported message
This commit is contained in:
Pim
2019-06-06 10:40:15 +02:00
committed by GitHub
parent 34c6ad957d
commit 024e7c5a62
23 changed files with 240 additions and 60 deletions
+21 -1
View File
@@ -11,7 +11,9 @@ describe('plugin', () => {
beforeEach(() => jest.clearAllMocks())
beforeAll(() => (Vue = loadVueMetaPlugin()))
test('is loaded', () => {
test('not loaded when no metaInfo defined', () => {
const warn = jest.spyOn(console, 'warn').mockImplementation(() => {})
const instance = new Vue()
expect(instance.$meta).toEqual(expect.any(Function))
@@ -19,6 +21,24 @@ describe('plugin', () => {
expect(instance.$meta().refresh).toEqual(expect.any(Function))
expect(instance.$meta().getOptions).toEqual(expect.any(Function))
expect(instance.$meta().inject()).not.toBeDefined()
expect(warn).toHaveBeenCalledTimes(1)
expect(instance.$meta().refresh()).not.toBeDefined()
expect(warn).toHaveBeenCalledTimes(2)
instance.$meta().getOptions()
expect(warn).toHaveBeenCalledTimes(3)
warn.mockRestore()
})
test('is loaded', () => {
const instance = new Vue({ metaInfo: {} })
expect(instance.$meta).toEqual(expect.any(Function))
expect(instance.$meta().inject).toEqual(expect.any(Function))
expect(instance.$meta().refresh).toEqual(expect.any(Function))
expect(instance.$meta().getOptions).toEqual(expect.any(Function))
expect(instance.$meta().inject()).toBeDefined()
expect(instance.$meta().refresh()).toBeDefined()