From 505152bf4cd2b2841b056598db4b43505dc82a65 Mon Sep 17 00:00:00 2001 From: Nikolay Kostyurin Date: Mon, 24 Sep 2018 00:30:46 +0200 Subject: [PATCH] fix(plugin-helper): better handle content of TagNode --- packages/bbob-plugin-helper/src/TagNode.js | 2 +- packages/bbob-plugin-helper/test/index.test.js | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/packages/bbob-plugin-helper/src/TagNode.js b/packages/bbob-plugin-helper/src/TagNode.js index 9eb9724..528b6b8 100644 --- a/packages/bbob-plugin-helper/src/TagNode.js +++ b/packages/bbob-plugin-helper/src/TagNode.js @@ -5,7 +5,7 @@ class TagNode { constructor(tag, attrs, content) { this.tag = tag; this.attrs = attrs; - this.content = content; + this.content = [].concat(content); } attr(name, value) { diff --git a/packages/bbob-plugin-helper/test/index.test.js b/packages/bbob-plugin-helper/test/index.test.js index 0a4669f..ba23186 100644 --- a/packages/bbob-plugin-helper/test/index.test.js +++ b/packages/bbob-plugin-helper/test/index.test.js @@ -4,6 +4,7 @@ import { getNodeLength, isTagNode, isStringNode, + isEOL, } from '../src'; describe('@bbob/plugin-helper', () => { @@ -65,4 +66,8 @@ describe('@bbob/plugin-helper', () => { expect(attrValue('test', attrs)).toBe('test="{"tag":"test"}"'); }); + + test('isEOL', () => { + expect(isEOL('\n')).toBe(true) + }) });