diff --git a/tests/unit/parsers/html-test.js b/tests/unit/parsers/html-test.js index f1a63b715..10efd7747 100644 --- a/tests/unit/parsers/html-test.js +++ b/tests/unit/parsers/html-test.js @@ -9,7 +9,18 @@ function parseHTML(html, options={}) { return new HTMLParser(builder, options).parse(html); } -module('Unit: Parser: HTMLParser'); +let didParseVideo; +function videoParserPlugin(node) { + if (node.tagName === 'VIDEO') { + didParseVideo = true; + } +} + +module('Unit: Parser: HTMLParser', { + beforeEach() { + didParseVideo = false; + } +}); test('style tags are ignored', (assert) => { // This is the html you get when copying a message from Slack's desktop app @@ -32,3 +43,29 @@ test('newlines ("\\n") are replaced with space characters', (assert) => { assert.postIsSimilar(post, expected); }); + +// see https://github.com/bustlelabs/mobiledoc-kit/issues/494 +test('top-level unknown void elements are parsed', (assert) => { + let html = ``; + parseHTML(html, {plugins: [videoParserPlugin]}); + assert.ok(didParseVideo); +}); + +// see https://github.com/bustlelabs/mobiledoc-kit/issues/494 +test('top-level unknown elements are parsed', (assert) => { + let html = ``; + parseHTML(html, {plugins: [videoParserPlugin]}); + assert.ok(didParseVideo); +}); + +test('nested void unknown elements are parsed', (assert) => { + let html = `
......
`; + parseHTML(html, {plugins: [videoParserPlugin]}); + assert.ok(didParseVideo); +}); + +test('nested unknown elements are parsed', (assert) => { + let html = `......
`; + parseHTML(html, {plugins: [videoParserPlugin]}); + assert.ok(didParseVideo); +});