mirror of
https://github.com/tenrok/vue-meta.git
synced 2026-06-23 05:40:33 +03:00
test: add e2e tests
fix: boolean attributes client side
This commit is contained in:
committed by
Alexander Lichter
parent
a853ce3de7
commit
05b8891110
Vendored
+17
@@ -0,0 +1,17 @@
|
||||
<!doctype html>
|
||||
<html data-vue-meta-server-rendered {{ htmlAttrs.text() }}>
|
||||
<head {{ headAttrs.text() }}>
|
||||
{{ meta.text() }}
|
||||
{{ title.text() }}
|
||||
{{ link.text() }}
|
||||
{{ style.text() }}
|
||||
{{ webpackAssets }}
|
||||
{{ script.text() }}
|
||||
{{ noscript.text() }}
|
||||
</head>
|
||||
<body {{ bodyAttrs.text() }}>
|
||||
{{ app }}
|
||||
{{ script.text({ body: true }) }}
|
||||
{{ noscript.text({ body: true }) }}
|
||||
</body>
|
||||
</html>
|
||||
Vendored
-33
@@ -1,33 +0,0 @@
|
||||
<template>
|
||||
<html {{ head.headAttrs.text() }}>
|
||||
<head></head>
|
||||
bla
|
||||
</html>
|
||||
</template>
|
||||
|
||||
|
||||
<script>
|
||||
export default {
|
||||
metaInfo() {
|
||||
return {
|
||||
title: this.title
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
title: 'Hello World',
|
||||
htmlAttrs: {
|
||||
lang: 'en'
|
||||
},
|
||||
meta: [
|
||||
{ charset: 'utf-8' }
|
||||
]
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
head() {
|
||||
return meta.inject()
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
Vendored
+21
@@ -0,0 +1,21 @@
|
||||
<template>
|
||||
<div id="app">
|
||||
<h1>Basic</h1>
|
||||
<router-view></router-view>
|
||||
<p>Inspect Element to see the meta info</p>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
metaInfo: {
|
||||
meta: [
|
||||
{ vmid: 'charset', charset: 'utf-8' }
|
||||
]
|
||||
},
|
||||
mounted() {
|
||||
this.$router.afterEach((to, from) => this.$emit('routeChanged', to, from))
|
||||
window.$vueMeta = this
|
||||
}
|
||||
}
|
||||
</script>
|
||||
Vendored
+10
@@ -0,0 +1,10 @@
|
||||
import Vue from 'vue'
|
||||
import VueMeta from '../../../src/browser'
|
||||
import App from './App.vue'
|
||||
import createRouter from './router'
|
||||
|
||||
Vue.use(VueMeta)
|
||||
|
||||
App.router = createRouter()
|
||||
|
||||
new Vue(App).$mount('#app')
|
||||
Vendored
+18
@@ -0,0 +1,18 @@
|
||||
import Vue from 'vue'
|
||||
import Router from 'vue-router'
|
||||
|
||||
Vue.use(Router)
|
||||
|
||||
const Home = () => import('./views/home.vue')
|
||||
const Post = () => import('./views/about.vue')
|
||||
|
||||
export default function createRouter() {
|
||||
return new Router({
|
||||
mode: 'hash',
|
||||
base: '/',
|
||||
routes: [
|
||||
{ path: '/', component: Home },
|
||||
{ path: '/about', component: Post }
|
||||
]
|
||||
})
|
||||
}
|
||||
Vendored
+10
@@ -0,0 +1,10 @@
|
||||
import Vue from 'vue'
|
||||
import VueMeta from '../../../src'
|
||||
import App from './App.vue'
|
||||
import createRouter from './router'
|
||||
|
||||
Vue.use(VueMeta)
|
||||
|
||||
App.router = createRouter()
|
||||
|
||||
export default new Vue(App)
|
||||
Vendored
+16
@@ -0,0 +1,16 @@
|
||||
<template>
|
||||
<div>
|
||||
<h2>About</h2>
|
||||
<router-link to="/">Go to Home</router-link>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
metaInfo() {
|
||||
return {
|
||||
title: 'About'
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
Vendored
+37
@@ -0,0 +1,37 @@
|
||||
<template>
|
||||
<div>
|
||||
<h2>Home</h2>
|
||||
<router-link to="/about">Go to About</router-link>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
metaInfo() {
|
||||
return {
|
||||
title: 'Home',
|
||||
titleTemplate: '%s | Vue Meta Test',
|
||||
htmlAttrs: {
|
||||
lang: 'en',
|
||||
allowfullscreen: undefined,
|
||||
amp: true
|
||||
},
|
||||
headAttrs: {
|
||||
test: true
|
||||
},
|
||||
meta: [
|
||||
{ name: 'description', content: 'Hello', vmid: 'test' }
|
||||
],
|
||||
script: [
|
||||
{ vmid: 'ldjson', innerHTML: '{ "@context": "http://www.schema.org", "@type": "Organization" }', type: 'application/ld+json' },
|
||||
{ innerHTML: '{ "more": "data" }', type: 'application/ld+json' }
|
||||
],
|
||||
noscript: [
|
||||
{ innerHTML: '{ "body": "yes" }', body: true, type: 'application/ld+json' }
|
||||
],
|
||||
__dangerouslyDisableSanitizers: ['noscript'],
|
||||
__dangerouslyDisableSanitizersByTagID: { ldjson: ['innerHTML'] }
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
Vendored
-34
@@ -1,34 +0,0 @@
|
||||
<template>
|
||||
<div>
|
||||
<hello-world v-if="childVisible"></hello-world>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import HelloWorld from './hello-world.vue'
|
||||
|
||||
export default {
|
||||
components: {
|
||||
HelloWorld
|
||||
},
|
||||
props: {
|
||||
changed: {
|
||||
type: Function
|
||||
}
|
||||
},
|
||||
metaInfo() {
|
||||
return {
|
||||
changed: this._changed
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
childVisible: false,
|
||||
_changed: () => {}
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this._changed = this.changed.bind(this)
|
||||
}
|
||||
}
|
||||
</script>
|
||||
Vendored
-26
@@ -1,26 +0,0 @@
|
||||
<template>
|
||||
<div>
|
||||
<hello-world v-if="childVisible"></hello-world>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import HelloWorld from './hello-world.vue'
|
||||
|
||||
export default {
|
||||
components: {
|
||||
HelloWorld
|
||||
},
|
||||
metaInfo() {
|
||||
return {
|
||||
title: this.title,
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
childVisible: true,
|
||||
title: 'Goodbye World'
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
Vendored
-24
@@ -1,24 +0,0 @@
|
||||
<template>
|
||||
<div>Test</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
metaInfo() {
|
||||
return {
|
||||
title: this.title
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
title: 'Hello World',
|
||||
htmlAttrs: {
|
||||
lang: 'en'
|
||||
},
|
||||
meta: [
|
||||
{ charset: 'utf-8' }
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
Vendored
-28
@@ -1,28 +0,0 @@
|
||||
<template>
|
||||
<div>
|
||||
<keep-alive>
|
||||
<hello-world v-if="childVisible"></hello-world>
|
||||
</keep-alive>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import HelloWorld from './hello-world.vue'
|
||||
|
||||
export default {
|
||||
components: {
|
||||
HelloWorld
|
||||
},
|
||||
metaInfo() {
|
||||
return {
|
||||
title: this.title,
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
childVisible: true,
|
||||
title: 'Alive World'
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
Reference in New Issue
Block a user