@wordpress/e2e-test-utils
Version:
End-To-End (E2E) test utils for WordPress.
23 lines (22 loc) • 604 B
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.setPostContent = setPostContent;
/**
* Sets code editor content
*
* @param {string} content New code editor content.
*
* @return {Promise} Promise resolving with an array containing all blocks in the document.
*/
async function setPostContent(content) {
return await page.evaluate(_content => {
const {
dispatch
} = window.wp.data;
const blocks = wp.blocks.parse(_content);
dispatch('core/block-editor').resetBlocks(blocks);
}, content);
}
//# sourceMappingURL=set-post-content.js.map