fix tests

This commit is contained in:
Henry Jameson 2022-11-27 00:11:54 +02:00
commit 74813864fc
3 changed files with 32 additions and 10 deletions

View file

@ -28,7 +28,14 @@ export const getAttrs = (tag, filter) => {
if (!v) return [k, true]
return [k, v.substring(1, v.length - 1)]
})
const defaultFilter = ([k, v]) => (k.toLowerCase() !== 'class' && k.toLowerCase() !== 'style')
const defaultFilter = ([k, v]) => {
const attrKey = k.toLowerCase()
if (attrKey === 'style') return false
if (attrKey === 'class') {
return v === 'greentext' || v === 'cyantext'
}
return true
}
return Object.fromEntries(attrs.filter(filter || defaultFilter))
}