Skip to content

Commit

Permalink
Rename variable to make code more clear
Browse files Browse the repository at this point in the history
  • Loading branch information
atimmer committed Jan 25, 2019
1 parent be9870d commit 164a1d3
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions packages/blocks/src/api/validation.js
Original file line number Diff line number Diff line change
Expand Up @@ -553,30 +553,30 @@ export function isEquivalentHTML( actual, expected ) {
*
* Logs to console in development environments when invalid.
*
* @param {string|Object} blockTypeOrName Block type.
* @param {Object} attributes Parsed block attributes.
* @param {string} innerHTML Original block content.
* @param {string|Object} blockTypeOrName Block type.
* @param {Object} attributes Parsed block attributes.
* @param {string} expectedBlockContent Original block content.
*
* @return {boolean} Whether block is valid.
*/
export function isValidBlockContent( blockTypeOrName, attributes, innerHTML ) {
export function isValidBlockContent( blockTypeOrName, attributes, expectedBlockContent ) {
const blockType = normalizeBlockType( blockTypeOrName );
let saveContent;
let actualBlockContent;
try {
saveContent = getSaveContent( blockType, attributes );
actualBlockContent = getSaveContent( blockType, attributes );
} catch ( error ) {
log.error( 'Block validation failed because an error occurred while generating block content:\n\n%s', error.toString() );
return false;
}

const isValid = isEquivalentHTML( innerHTML, saveContent );
const isValid = isEquivalentHTML( expectedBlockContent, actualBlockContent );
if ( ! isValid ) {
log.error(
'Block validation failed for `%s` (%o).\n\nExpected:\n\n%s\n\nActual:\n\n%s',
blockType.name,
blockType,
saveContent,
innerHTML
actualBlockContent,
expectedBlockContent
);
}

Expand Down

0 comments on commit 164a1d3

Please sign in to comment.