mirror of
https://github.com/tenrok/vue-meta.git
synced 2026-06-25 15:30:33 +03:00
fix tests
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
import getMetaInfo from '../shared/getMetaInfo'
|
import getMetaInfo from '../shared/getMetaInfo'
|
||||||
import updateClientMetaInfo from './updateClientMetaInfo'
|
import updateClientMetaInfo from './updateClientMetaInfo'
|
||||||
|
|
||||||
export default function _refresh (options) {
|
export default function _refresh (options = {}) {
|
||||||
/**
|
/**
|
||||||
* When called, will update the current meta info with new meta info.
|
* When called, will update the current meta info with new meta info.
|
||||||
* Useful when updating meta info as the result of an asynchronous
|
* Useful when updating meta info as the result of an asynchronous
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import updateTitle from './updaters/updateTitle'
|
|||||||
import updateTagAttributes from './updaters/updateTagAttributes'
|
import updateTagAttributes from './updaters/updateTagAttributes'
|
||||||
import updateTags from './updaters/updateTags'
|
import updateTags from './updaters/updateTags'
|
||||||
|
|
||||||
export default function _updateClientMetaInfo (options) {
|
export default function _updateClientMetaInfo (options = {}) {
|
||||||
const { ssrAttribute } = options
|
const { ssrAttribute } = options
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
export default function _updateTagAttributes ({ attribute }) {
|
export default function _updateTagAttributes (options = {}) {
|
||||||
|
const { attribute } = options
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* updates the document's html tag attributes
|
* updates the document's html tag attributes
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
// borrow the slice method
|
// borrow the slice method
|
||||||
const toArray = Function.prototype.call.bind(Array.prototype.slice)
|
const toArray = Function.prototype.call.bind(Array.prototype.slice)
|
||||||
|
|
||||||
export default function _updateTags ({ attribute }) {
|
export default function _updateTags (options = {}) {
|
||||||
|
const { attribute } = options
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Updates meta tags inside <head> on the client. Borrowed from `react-helmet`:
|
* Updates meta tags inside <head> on the client. Borrowed from `react-helmet`:
|
||||||
* https://github.com/nfl/react-helmet/blob/004d448f8de5f823d10f838b02317521180f34da/src/Helmet.js#L195-L245
|
* https://github.com/nfl/react-helmet/blob/004d448f8de5f823d10f838b02317521180f34da/src/Helmet.js#L195-L245
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import titleGenerator from './generators/titleGenerator'
|
|||||||
import attrsGenerator from './generators/attrsGenerator'
|
import attrsGenerator from './generators/attrsGenerator'
|
||||||
import tagGenerator from './generators/tagGenerator'
|
import tagGenerator from './generators/tagGenerator'
|
||||||
|
|
||||||
export default function _generateServerInjector (options) {
|
export default function _generateServerInjector (options = {}) {
|
||||||
/**
|
/**
|
||||||
* Converts a meta info property to one that can be stringified on the server
|
* Converts a meta info property to one that can be stringified on the server
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
export default function _attrsGenerator ({ attribute }) {
|
export default function _attrsGenerator (options = {}) {
|
||||||
|
const { attribute } = options
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generates tag attributes for use on the server.
|
* Generates tag attributes for use on the server.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
export default function _tagGenerator ({ attribute }) {
|
export default function _tagGenerator (options = {}) {
|
||||||
|
const { attribute } = options
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generates meta, base, link, style, script, noscript tags for use on the server
|
* Generates meta, base, link, style, script, noscript tags for use on the server
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
export default function _titleGenerator ({ attribute }) {
|
export default function _titleGenerator (options = {}) {
|
||||||
|
const { attribute } = options
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generates title output for the server
|
* Generates title output for the server
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import getMetaInfo from '../shared/getMetaInfo'
|
import getMetaInfo from '../shared/getMetaInfo'
|
||||||
import generateServerInjector from './generateServerInjector'
|
import generateServerInjector from './generateServerInjector'
|
||||||
|
|
||||||
export default function _inject (options) {
|
export default function _inject (options = {}) {
|
||||||
/**
|
/**
|
||||||
* Converts the state of the meta info object such that each item
|
* Converts the state of the meta info object such that each item
|
||||||
* can be compiled to a tag string on the server
|
* can be compiled to a tag string on the server
|
||||||
|
|||||||
+1
-1
@@ -1,7 +1,7 @@
|
|||||||
import inject from '../server/inject'
|
import inject from '../server/inject'
|
||||||
import refresh from '../client/refresh'
|
import refresh from '../client/refresh'
|
||||||
|
|
||||||
export default function _$meta (options) {
|
export default function _$meta (options = {}) {
|
||||||
/**
|
/**
|
||||||
* Returns an injector for server-side rendering.
|
* Returns an injector for server-side rendering.
|
||||||
* @this {Object} - the Vue instance (a root component)
|
* @this {Object} - the Vue instance (a root component)
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
import deepmerge from 'deepmerge'
|
import deepmerge from 'deepmerge'
|
||||||
import getComponentOption from './getComponentOption'
|
import getComponentOption from './getComponentOption'
|
||||||
|
|
||||||
export default function _getMetaInfo ({ keyName, tagIDKeyName }) {
|
export default function _getMetaInfo (options = {}) {
|
||||||
|
const { keyName, tagIDKeyName } = options
|
||||||
/**
|
/**
|
||||||
* Returns the correct meta info for the given component
|
* Returns the correct meta info for the given component
|
||||||
* (child components will overwrite parent meta info)
|
* (child components will overwrite parent meta info)
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
import Vue from 'vue'
|
import Vue from 'vue'
|
||||||
import getMetaInfo from '../src/shared/getMetaInfo'
|
import _getMetaInfo from '../src/shared/getMetaInfo'
|
||||||
|
|
||||||
|
const getMetaInfo = _getMetaInfo()
|
||||||
|
|
||||||
describe('getMetaInfo', () => {
|
describe('getMetaInfo', () => {
|
||||||
// const container = document.createElement('div')
|
// const container = document.createElement('div')
|
||||||
|
|||||||
Reference in New Issue
Block a user