diff --git a/addons/html_builder/static/src/builder/components/option_container.js b/addons/html_builder/static/src/builder/components/option_container.js index 01a1f0de467dd..96a30f1575dee 100644 --- a/addons/html_builder/static/src/builder/components/option_container.js +++ b/addons/html_builder/static/src/builder/components/option_container.js @@ -2,6 +2,7 @@ import { Component, useSubEnv } from "@odoo/owl"; import { defaultBuilderComponents } from "../builder_components/default_builder_components"; import { useVisibilityObserver, useApplyVisibility } from "../builder_components/utils"; import { DependencyManager } from "../plugins/dependency_manager"; +import { getSnippetName } from "@html_builder/utils"; export class OptionsContainer extends Component { static template = "html_builder.OptionsContainer"; @@ -22,6 +23,6 @@ export class OptionsContainer extends Component { } get title() { - return this.env.getEditingElement().dataset.name; + return getSnippetName(this.env.getEditingElement()); } } diff --git a/addons/html_builder/static/tests/custom_tab/misc.test.js b/addons/html_builder/static/tests/custom_tab/misc.test.js index 40362bab0de6b..6e8a4241f321d 100644 --- a/addons/html_builder/static/tests/custom_tab/misc.test.js +++ b/addons/html_builder/static/tests/custom_tab/misc.test.js @@ -106,7 +106,10 @@ test("option that matches several elements", async () => { await setupWebsiteBuilder(`
b
`); await contains(":iframe .test-target").click(); expect(".options-container:not(.d-none)").toHaveCount(2); - expect(queryAllTexts(".options-container:not(.d-none)")).toEqual(["Row\nTest", "Row\nTest"]); + expect(queryAllTexts(".options-container:not(.d-none)")).toEqual([ + "Block\nRow\nTest", + "Block\nRow\nTest", + ]); }); test("Snippets options respect sequencing", async () => { @@ -197,7 +200,7 @@ test("hide empty OptionContainer and display OptionContainer with content (with await contains("[data-class-action='my-custom-class']").click(); expect(".options-container:not(.d-none)").toHaveCount(2); - expect(".options-container:not(.d-none):nth-child(2)").toHaveText("Row 2\nTest"); + expect(".options-container:not(.d-none):nth-child(2)").toHaveText("Block\nRow 2\nTest"); }); test("hide empty OptionContainer and display OptionContainer with content (with BuilderButtonGroup) - 2", async () => { @@ -226,7 +229,7 @@ test("hide empty OptionContainer and display OptionContainer with content (with await contains("[data-class-action='my-custom-class']").click(); expect(".options-container:not(.d-none)").toHaveCount(2); - expect(".options-container:not(.d-none):nth-child(2)").toHaveText("Row 2\nTest"); + expect(".options-container:not(.d-none):nth-child(2)").toHaveText("Block\nRow 2\nTest"); }); test("display empty message if any option match the selected element", async () => {