Skip to content

Commit

Permalink
Update unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
brandonpayton committed Oct 9, 2018
1 parent 5be3d3b commit fb979f4
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
18 changes: 9 additions & 9 deletions packages/editor/src/store/test/selectors.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ import {
getBlockTypes,
getDefaultBlockName,
setDefaultBlockName,
getUnknownTypeHandlerName,
setUnknownTypeHandlerName,
getFreeformContentHandlerName,
setFreeformContentHandlerName,
} from '@wordpress/blocks';
import { moment } from '@wordpress/date';
import { RawHTML } from '@wordpress/element';
Expand Down Expand Up @@ -3022,11 +3022,11 @@ describe( 'selectors', () => {
} );

describe( 'getEditedPostContent', () => {
let originalDefaultBlockName, originalUnknownTypeHandlerName;
let originalDefaultBlockName, originalFreeformContentHandlerName;

beforeAll( () => {
originalDefaultBlockName = getDefaultBlockName();
originalUnknownTypeHandlerName = getUnknownTypeHandlerName();
originalFreeformContentHandlerName = getFreeformContentHandlerName();

registerBlockType( 'core/default', {
category: 'common',
Expand All @@ -3050,12 +3050,12 @@ describe( 'selectors', () => {
save: ( { attributes } ) => <RawHTML>{ attributes.html }</RawHTML>,
} );
setDefaultBlockName( 'core/default' );
setUnknownTypeHandlerName( 'core/unknown' );
setFreeformContentHandlerName( 'core/unknown' );
} );

afterAll( () => {
setDefaultBlockName( originalDefaultBlockName );
setUnknownTypeHandlerName( originalUnknownTypeHandlerName );
setFreeformContentHandlerName( originalFreeformContentHandlerName );
getBlockTypes().forEach( ( block ) => {
unregisterBlockType( block.name );
} );
Expand Down Expand Up @@ -3110,7 +3110,7 @@ describe( 'selectors', () => {
} );

it( 'returns removep\'d serialization of blocks for single unknown', () => {
const unknownBlock = createBlock( getUnknownTypeHandlerName(), {
const unknownBlock = createBlock( getFreeformContentHandlerName(), {
html: '<p>foo</p>',
} );
const state = {
Expand All @@ -3134,10 +3134,10 @@ describe( 'selectors', () => {
} );

it( 'returns non-removep\'d serialization of blocks for multiple unknown', () => {
const firstUnknown = createBlock( getUnknownTypeHandlerName(), {
const firstUnknown = createBlock( getFreeformContentHandlerName(), {
html: '<p>foo</p>',
} );
const secondUnknown = createBlock( getUnknownTypeHandlerName(), {
const secondUnknown = createBlock( getFreeformContentHandlerName(), {
html: '<p>bar</p>',
} );
const state = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@
"innerHTML": "\n<p>Testing missing block with some</p>\n<div class=\"wp-some-class\">\n\tHTML <span style=\"color: red;\">content</span>\n</div>\n"
},
{
"attrs": {},
"blockName": null,
"attrs": {},
"innerBlocks": [],
"innerHTML": "\n"
}
]

0 comments on commit fb979f4

Please sign in to comment.