Skip to content

Commit

Permalink
use setupWebsiteBuilderWithSnippet when possible
Browse files Browse the repository at this point in the history
  • Loading branch information
loco-odoo committed Jan 24, 2025
1 parent 89a955d commit ad22390
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 24 deletions.
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
import { expect, test } from "@odoo/hoot";
import { queryAll } from "@odoo/hoot-dom";
import { contains } from "@web/../tests/web_test_helpers";
import { defineWebsiteModels, setupWebsiteBuilder } from "../helpers";
import { insertStructureSnippet } from "./helpers";
import { defineWebsiteModels } from "../helpers";
import { setupWebsiteBuilderWithSnippet } from "./helpers";

defineWebsiteModels();

test("toggle price list description items", async () => {
const { getEditor } = await setupWebsiteBuilder("<div></div>");
const editor = getEditor();
await insertStructureSnippet(editor, "s_pricelist_boxed");
await setupWebsiteBuilderWithSnippet("s_pricelist_boxed");
await contains(":iframe .s_pricelist_boxed_section").click();
expect(
"[data-action-id='togglePriceListDescription'] .o-checkbox .form-check-input:checked"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
import { expect, test } from "@odoo/hoot";
import { contains } from "@web/../tests/web_test_helpers";
import { defineWebsiteModels, setupWebsiteBuilder } from "../helpers";
import { insertStructureSnippet } from "./helpers";
import { defineWebsiteModels } from "../helpers";
import { setupWebsiteBuilderWithSnippet } from "./helpers";

defineWebsiteModels();

test("modify the steps color", async () => {
const { getEditor } = await setupWebsiteBuilder("<div></div>");
const editor = getEditor();
await insertStructureSnippet(editor, "s_process_steps");
await setupWebsiteBuilderWithSnippet("s_process_steps");
await contains(":iframe .s_process_steps").click();
await contains("[data-label='Connector'] .o_we_color_preview").click();
await contains(".o-overlay-item [data-color='#FF0000']").click();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,14 @@ import { insertText, undo } from "@html_editor/../tests/_helpers/user_actions";
import { expect, test } from "@odoo/hoot";
import { click, queryAll, queryOne, queryAllTexts } from "@odoo/hoot-dom";
import { contains } from "@web/../tests/web_test_helpers";
import { defineWebsiteModels, setupWebsiteBuilder } from "../helpers";
import { defineWebsiteModels } from "../helpers";
import { insertStructureSnippet, setupWebsiteBuilderWithSnippet } from "./helpers";

defineWebsiteModels();

test("edit title in content with table of content", async () => {
const { getEditor } = await setupWebsiteBuilder("<div></div>");
const { getEditor } = await setupWebsiteBuilderWithSnippet("s_table_of_content");
const editor = getEditor();
await insertStructureSnippet(editor, "s_table_of_content");
expect(":iframe .s_table_of_content").toHaveCount(1);
expect(queryAllTexts(":iframe .s_table_of_content_navbar a")).toEqual([
"Intuitive system",
Expand Down Expand Up @@ -46,9 +45,8 @@ test("edit title in content with table of content", async () => {
});

test("click on addItem option button", async () => {
const { getEditor } = await setupWebsiteBuilder("<div><p>Text</p></div>");
const { getEditor } = await setupWebsiteBuilderWithSnippet("s_table_of_content");
const editor = getEditor();
await insertStructureSnippet(editor, "s_table_of_content");
expect(queryAllTexts(":iframe .s_table_of_content_navbar a")).toEqual([
"Intuitive system",
"Design features",
Expand Down Expand Up @@ -83,9 +81,8 @@ test("click on addItem option button", async () => {
});

test("hide title in content with table of content", async () => {
const { getEditor } = await setupWebsiteBuilder("<div></div>");
const { getEditor } = await setupWebsiteBuilderWithSnippet("s_table_of_content");
const editor = getEditor();
await insertStructureSnippet(editor, "s_table_of_content");
expect(":iframe .s_table_of_content").toHaveCount(1);
expect(queryAllTexts(":iframe .s_table_of_content_navbar a")).toEqual([
"Intuitive system",
Expand All @@ -107,9 +104,8 @@ test("hide title in content with table of content", async () => {
});

test("remove main content with table of content", async () => {
const { getEditor } = await setupWebsiteBuilder("<div></div>");
const { getEditor } = await setupWebsiteBuilderWithSnippet("s_table_of_content");
const editor = getEditor();
await insertStructureSnippet(editor, "s_table_of_content");
expect(":iframe .s_table_of_content").toHaveCount(1);
expect(queryAllTexts(":iframe .s_table_of_content_navbar a")).toEqual([
"Intuitive system",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
import { expect, test } from "@odoo/hoot";
import { queryAll, queryAllTexts } from "@odoo/hoot-dom";
import { contains } from "@web/../tests/web_test_helpers";
import { defineWebsiteModels, setupWebsiteBuilder } from "../helpers";
import { insertStructureSnippet } from "./helpers";
import { defineWebsiteModels } from "../helpers";
import { setupWebsiteBuilderWithSnippet } from "./helpers";

defineWebsiteModels();

test("add a date in timeline", async () => {
const { getEditor } = await setupWebsiteBuilder("<div></div>");
const editor = getEditor();
await insertStructureSnippet(editor, "s_timeline");
await setupWebsiteBuilderWithSnippet("s_timeline");
expect(queryAllTexts(":iframe .s_timeline_row h3")).toEqual([
"First Feature",
"Second Feature",
Expand Down

0 comments on commit ad22390

Please sign in to comment.