Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
} from '@wordpress/blocks';
import { parse as grammarParse } from '@wordpress/block-serialization-default-parser';
import { registerCoreBlocks } from '@wordpress/block-library';
import { //eslint-disable-line no-restricted-syntax
blockNameToFixtureBasename,
getAvailableBlockFixturesBasenames,
getBlockFixtureHTML,
getBlockFixtureJSON,
getBlockFixtureParsedJSON,
getBlockFixtureSerializedHTML,
writeBlockFixtureParsedJSON,
writeBlockFixtureJSON,
writeBlockFixtureSerializedHTML,
} from '@wordpress/e2e-tests/fixtures';
const blockBasenames = getAvailableBlockFixturesBasenames();
function normalizeParsedBlocks( blocks ) {
return blocks.map( ( block, index ) => {
// Clone and remove React-instance-specific stuff; also, attribute
// values that equal `undefined` will be removed
block = JSON.parse( JSON.stringify( block ) );
// Change client IDs to a predictable value
block.clientId = '_clientId_' + index;
// Recurse to normalize inner blocks
block.innerBlocks = normalizeParsedBlocks( block.innerBlocks );
return block;
} );
}