import { Builder } from "@html_builder/builder"; import { CORE_PLUGINS } from "@html_builder/core/core_plugins"; import { Img } from "@html_builder/core/img"; import { SetupEditorPlugin } from "@html_builder/core/setup_editor_plugin"; import { unformat } from "@html_editor/../tests/_helpers/format"; import { setContent } from "@html_editor/../tests/_helpers/selection"; import { insertText } from "@html_editor/../tests/_helpers/user_actions"; import { LocalOverlayContainer } from "@html_editor/local_overlay_container"; import { Plugin } from "@html_editor/plugin"; import { withSequence } from "@html_editor/utils/resource"; import { defineMailModels } from "@mail/../tests/mail_test_helpers"; import { after } from "@odoo/hoot"; import { animationFrame, waitForNone, queryOne, waitFor, advanceTime, tick } from "@odoo/hoot-dom"; import { Component, onMounted, useRef, useState, useSubEnv, xml } from "@odoo/owl"; import { contains, defineModels, models, mountWithCleanup, patchWithCleanup, } from "@web/../tests/web_test_helpers"; import { loadBundle } from "@web/core/assets"; import { isBrowserFirefox } from "@web/core/browser/feature_detection"; import { registry } from "@web/core/registry"; import { uniqueId } from "@web/core/utils/functions"; export function patchWithCleanupImg() { const defaultImg = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mP8z9DwHwAGBQKA3H7sNwAAAABJRU5ErkJggg=="; patchWithCleanup(Img, { template: xml``, }); patchWithCleanup(Img.prototype, { loadImage: () => {}, getSvg: function () { this.isSvg = () => false; }, }); } export function getSnippetView(snippets) { const { snippet_groups, snippet_custom, snippet_structure, snippet_content } = snippets; return ` ${(snippet_groups || []).join("")} ${(snippet_structure || []).join("")} ${(snippet_custom || []).join("")} ${(snippet_content || []).join("")} `; } export function getInnerContent({ name, content, keywords = [], imagePreview = "", thumbnail = "", }) { keywords = keywords.join(", "); return `
${content}
`; } /** * Creates snippet structure HTML for test fixtures * @param {Object} options - Snippet structure configuration * @param {string} options.name - The display name of the snippet * @param {string} options.content - The HTML content of the snippet * @param {string[]} [options.keywords=[]] - Search keywords for the snippet * @param {string} options.groupName - The snippet group (category) name * @param {string} [options.imagePreview=""] - URL to preview image * @param {string|number} [options.moduleId=""] - Module ID if snippet belongs to a module * @param {string} [options.moduleDisplayName=""] - Human-readable module name * @returns {string} HTML string for the snippet structure */ export function getSnippetStructure({ name, content, keywords = [], groupName, imagePreview = "", moduleId = "", moduleDisplayName = "", }) { keywords = keywords.join(", "); return `
${content}
`; } class BuilderContainer extends Component { static template = xml`