UNPKG

@wordpress/e2e-test-utils

Version:
34 lines (32 loc) 805 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.deleteAllWidgets = deleteAllWidgets; var _restApi = require("./rest-api"); /** * Internal dependencies */ /** * Delete all the widgets in the widgets screen. */ async function deleteAllWidgets() { const [widgets, sidebars] = await Promise.all([(0, _restApi.rest)({ path: '/wp/v2/widgets' }), (0, _restApi.rest)({ path: '/wp/v2/sidebars' })]); await (0, _restApi.batch)(widgets.map(widget => ({ method: 'DELETE', path: `/wp/v2/widgets/${widget.id}?force=true` }))); await (0, _restApi.batch)(sidebars.map(sidebar => ({ method: 'POST', path: `/wp/v2/sidebars/${sidebar.id}`, body: { id: sidebar.id, widgets: [] } }))); } //# sourceMappingURL=widgets.js.map