Skip to content

Commit

Permalink
fix OptionPlugin title
Browse files Browse the repository at this point in the history
  • Loading branch information
FrancoisGe committed Dec 20, 2024
1 parent 3fc547d commit 7e563b8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand All @@ -22,6 +23,6 @@ export class OptionsContainer extends Component {
}

get title() {
return this.env.getEditingElement().dataset.name;
return getSnippetName(this.env.getEditingElement());
}
}
9 changes: 6 additions & 3 deletions addons/html_builder/static/tests/custom_tab/misc.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,10 @@ test("option that matches several elements", async () => {
await setupWebsiteBuilder(`<div class="a"><div class="a test-target">b</div></div>`);
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 () => {
Expand Down Expand Up @@ -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 () => {
Expand Down Expand Up @@ -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 () => {
Expand Down

0 comments on commit 7e563b8

Please sign in to comment.