Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Use valid HTML in unit tests
  • Loading branch information
youknowriad authored and ellatrix committed Apr 16, 2018
commit 665c59e7e5227d6a5921eb023f0761a3079f338e
6 changes: 3 additions & 3 deletions blocks/rich-text/test/__snapshots__/format.js.snap
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`createTinyMCEElement should render a TinyMCE element 1`] = `
<p
a-prop="hi"
<div
data-prop="hi"
>
<p>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm, isn't this invalid HTML? Won't React warn on nesting paragraphs? Or do we not care here for these tests?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Our new non-React serializer is much less noisy about issues it encounters. Not to say we shouldn't be using valid HTML here though.

Child
</p>
</p>
</div>
`;

exports[`domToElement should return the corresponding element 1`] = `
Expand Down
4 changes: 2 additions & 2 deletions blocks/rich-text/test/format.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import {
} from '../format';

describe( 'createTinyMCEElement', () => {
const type = 'p';
const type = 'div';
const children = <p>Child</p>;

test( 'should return null', () => {
Expand All @@ -41,7 +41,7 @@ describe( 'createTinyMCEElement', () => {

test( 'should render a TinyMCE element', () => {
const props = {
'a-prop': 'hi',
'data-prop': 'hi',
};

const wrapper = shallow( createTinyMCEElement( type, props, children ) );
Expand Down