2
0
mirror of https://github.com/tenrok/vue-meta.git synced 2026-06-20 11:00:34 +03:00

test: add e2e tests

fix: boolean attributes client side
This commit is contained in:
pimlie
2019-03-09 17:56:47 +01:00
committed by Alexander Lichter
parent a853ce3de7
commit 05b8891110
36 changed files with 1999 additions and 105 deletions
+1 -3
View File
@@ -15,9 +15,7 @@ const startUpdate = (hasGlobalWindow ? window.requestAnimationFrame : null) || (
* @return {Number} id - a new ID
*/
export default function batchUpdate(id, callback) {
if (id) {
stopUpdate(id)
}
stopUpdate(id)
return startUpdate(() => {
id = null
+1 -1
View File
@@ -24,7 +24,7 @@ export default function updateClientMetaInfo(options = {}, newInfo) {
const htmlTag = getTag(tags, 'html')
// if this is a server render, then dont update
if (htmlTag.getAttribute(ssrAttribute)) {
if (htmlTag.hasAttribute(ssrAttribute)) {
// remove the server render attribute so we can update on (next) changes
htmlTag.removeAttribute(ssrAttribute)
return false
+4 -1
View File
@@ -1,3 +1,4 @@
import { booleanHtmlAttributes } from '../../shared/constants'
import isArray from '../../shared/isArray'
/**
@@ -14,7 +15,9 @@ export default function updateAttribute({ attribute } = {}, attrs, tag) {
const keepIndexes = []
for (const attr in attrs) {
if (attrs.hasOwnProperty(attr)) {
const value = isArray(attrs[attr]) ? attrs[attr].join(' ') : attrs[attr]
const value = booleanHtmlAttributes.includes(attr)
? ''
: isArray(attrs[attr]) ? attrs[attr].join(' ') : attrs[attr]
tag.setAttribute(attr, value || '')