Skip to content

Commit

Permalink
Failing tests for #494
Browse files Browse the repository at this point in the history
  • Loading branch information
bantic authored and kevinansfield committed Jun 18, 2018
1 parent 8ffcb8a commit be446f6
Showing 1 changed file with 38 additions and 1 deletion.
39 changes: 38 additions & 1 deletion tests/unit/parsers/html-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 = `<video />`;
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 = `<video>...inner...</video>`;
parseHTML(html, {plugins: [videoParserPlugin]});
assert.ok(didParseVideo);
});

test('nested void unknown elements are parsed', (assert) => {
let html = `<p>...<video />...</p>`;
parseHTML(html, {plugins: [videoParserPlugin]});
assert.ok(didParseVideo);
});

test('nested unknown elements are parsed', (assert) => {
let html = `<p>...<video>inner</video>...</p>`;
parseHTML(html, {plugins: [videoParserPlugin]});
assert.ok(didParseVideo);
});

0 comments on commit be446f6

Please sign in to comment.