mirror of
https://github.com/tenrok/BBob.git
synced 2026-06-17 19:21:20 +03:00
fix(plugin-helper): avoid some malformed attributes in attrsToString (#26)
* attrsToString: To avoid some malformed attributes
Error:
```
TypeError: Cannot convert undefined or null to object
at Function.keys (<anonymous>)
at attrsToString
```
This errors appears if no `attrs` setted in custom tag:
```
const BBcodePresetTemp = BbobPresetHTML5.extend((tags: any) => {
tags.br = () => ({
tag: 'br',
// attrs: {}, // <-- Comment this line for error and add [br] to text
content: null,
});
return tags;
});
```
This commit is contained in:
committed by
Nikolay Kostyurin
parent
5291543855
commit
09ff9af9a2
@@ -79,4 +79,8 @@ describe('@bbob/plugin-helper', () => {
|
||||
disabled: true
|
||||
})).toBe(` tag="test" foo="bar" disabled`)
|
||||
})
|
||||
|
||||
test('attrsToString undefined', () => {
|
||||
expect(attrsToString(undefined)).toBe('')
|
||||
})
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user