File tree Expand file tree Collapse file tree 2 files changed +34
-1
lines changed Expand file tree Collapse file tree 2 files changed +34
-1
lines changed Original file line number Diff line number Diff line change @@ -87,7 +87,7 @@ export default function VueMeta (Vue, options = {}) {
87
87
if ( this . _hasMetaInfo ) {
88
88
// Wait that element is hidden before refreshing meta tags (to support animations)
89
89
const interval = setInterval ( ( ) => {
90
- if ( this . $el . offsetParent !== null ) return
90
+ if ( this . $el && this . $el . offsetParent !== null ) return
91
91
clearInterval ( interval )
92
92
batchID = batchUpdate ( batchID , ( ) => this . $meta ( ) . refresh ( ) )
93
93
} , 50 )
Original file line number Diff line number Diff line change
1
+ import Vue from 'vue'
2
+ import VueMeta from '../src/shared/plugin'
3
+ import {
4
+ VUE_META_KEY_NAME ,
5
+ VUE_META_ATTRIBUTE ,
6
+ VUE_META_SERVER_RENDERED_ATTRIBUTE ,
7
+ VUE_META_TAG_LIST_ID_KEY_NAME
8
+ } from '../src/shared/constants'
9
+
10
+ describe ( 'plugin' , ( ) => {
11
+ Vue . use ( VueMeta , {
12
+ keyName : VUE_META_KEY_NAME ,
13
+ attribute : VUE_META_ATTRIBUTE ,
14
+ ssrAttribute : VUE_META_SERVER_RENDERED_ATTRIBUTE ,
15
+ tagIDKeyName : VUE_META_TAG_LIST_ID_KEY_NAME
16
+ } )
17
+
18
+ it ( 'adds $meta() to Vue prototype' , ( ) => {
19
+ const instance = new Vue ( )
20
+ expect ( instance . $meta ) . to . be . a ( 'function' )
21
+ } )
22
+
23
+ it ( 'components have _hasMetaInfo set to true' , ( ) => {
24
+ const Component = Vue . component ( 'test-component' , {
25
+ template : '<div>Test</div>' ,
26
+ [ VUE_META_KEY_NAME ] : {
27
+ title : 'helloworld'
28
+ }
29
+ } )
30
+ const vm = new Vue ( Component ) . $mount ( )
31
+ expect ( vm . _hasMetaInfo ) . to . equal ( true )
32
+ } )
33
+ } )
You can’t perform that action at this time.
0 commit comments