mirror of
https://github.com/tenrok/vue-meta.git
synced 2026-05-26 02:44:05 +03:00
30 lines
687 B
JavaScript
30 lines
687 B
JavaScript
import Vue from 'vue'
|
|
import Meta from 'vue-meta'
|
|
|
|
import { Promise } from 'es6-promise'
|
|
|
|
Vue.use(Meta)
|
|
|
|
describe('basic', () => {
|
|
const container = document.createElement('div')
|
|
let vm
|
|
|
|
function setMetaInfo (metaInfo) {
|
|
return new Promise((resolve) => {
|
|
vm = new Vue({ el: container, metaInfo })
|
|
vm.$on('vue-meta-update', resolve)
|
|
})
|
|
}
|
|
|
|
afterEach(() => vm.$destroy())
|
|
|
|
it('sets a title', () => setMetaInfo({ title: 'Foo' })
|
|
.then(() => expect(document.title).to.equal('Foo')))
|
|
|
|
it('sets a title with a template', () => setMetaInfo({
|
|
title: 'Foo',
|
|
titleTemplate: '%s Bar'
|
|
})
|
|
.then(() => expect(document.title).to.equal('Foo Bar')))
|
|
})
|