mirror of
https://github.com/bringout/oca-ocb-web.git
synced 2026-04-18 22:32:02 +02:00
replace stale web_editor with html_editor and html_builder for 19.0
web_editor was removed in Odoo 19.0 and replaced by html_editor
and html_builder. The old web_editor was incorrectly included in
the 19.0 vanilla import.
🤖 assisted by claude
This commit is contained in:
parent
4b94f0abc5
commit
f866779561
1513 changed files with 396049 additions and 358525 deletions
|
|
@ -0,0 +1,44 @@
|
|||
import {
|
||||
after,
|
||||
before,
|
||||
BEGIN,
|
||||
END,
|
||||
SNIPPET_SPECIFIC,
|
||||
splitBetween,
|
||||
} from "@html_builder/utils/option_sequence";
|
||||
import { expect, test } from "@odoo/hoot";
|
||||
|
||||
const ARBITRARY_FAKE_POSITION = 7777777777;
|
||||
|
||||
test("before throws if position doesn't exist", async () => {
|
||||
expect(() => before(ARBITRARY_FAKE_POSITION)).toThrow();
|
||||
});
|
||||
|
||||
test("before throws if position is BEGIN", async () => {
|
||||
expect(() => before(BEGIN)).toThrow();
|
||||
});
|
||||
|
||||
test("before returns a smaller position", async () => {
|
||||
expect(before(SNIPPET_SPECIFIC)).toBeLessThan(SNIPPET_SPECIFIC);
|
||||
expect(before(END)).toBeLessThan(END);
|
||||
});
|
||||
|
||||
test("after throws if position doesn't exist", async () => {
|
||||
expect(() => after(ARBITRARY_FAKE_POSITION)).toThrow();
|
||||
});
|
||||
|
||||
test("after throws if position is END", async () => {
|
||||
expect(() => after(END)).toThrow();
|
||||
});
|
||||
|
||||
test("after returns a bigger position", async () => {
|
||||
expect(after(SNIPPET_SPECIFIC)).toBeGreaterThan(SNIPPET_SPECIFIC);
|
||||
expect(after(BEGIN)).toBeGreaterThan(BEGIN);
|
||||
});
|
||||
|
||||
test("splitBetween correctly splits to the right values", async () => {
|
||||
expect(splitBetween(0, 3, 2)).toMatch([1, 2]);
|
||||
expect(splitBetween(0, 10, 2)).toMatch([10 / 3, (2 * 10) / 3]);
|
||||
expect(splitBetween(0, 8, 7)).toMatch([1, 2, 3, 4, 5, 6, 7]);
|
||||
expect(splitBetween(1, 5, 3)).toMatch([2, 3, 4]);
|
||||
});
|
||||
|
|
@ -0,0 +1,83 @@
|
|||
import { setupHTMLBuilder } from "@html_builder/../tests/helpers";
|
||||
import { expect, test, describe } from "@odoo/hoot";
|
||||
import { animationFrame, clear, click, fill, waitFor } from "@odoo/hoot-dom";
|
||||
import { contains } from "@web/../tests/web_test_helpers";
|
||||
|
||||
describe.current.tags("desktop");
|
||||
|
||||
const websiteContent = `
|
||||
<div class="s_rating pt16 pb16" data-icon="fa-star" data-snippet="s_rating" data-name="Rating">
|
||||
<strong class="s_rating_title">Quality</strong>
|
||||
<div class="s_rating_icons o_not_editable">
|
||||
<span class="s_rating_active_icons">
|
||||
<i class="fa fa-star"></i>
|
||||
<i class="fa fa-star"></i>
|
||||
<i class="fa fa-star"></i>
|
||||
</span>
|
||||
<span class="s_rating_inactive_icons">
|
||||
<i class="fa fa-star-o"></i>
|
||||
<i class="fa fa-star-o"></i>
|
||||
</span>
|
||||
</div>
|
||||
</div>`;
|
||||
|
||||
test("change rating score", async () => {
|
||||
await setupHTMLBuilder(websiteContent);
|
||||
expect(":iframe .s_rating .s_rating_active_icons i").toHaveCount(3);
|
||||
expect(":iframe .s_rating .s_rating_inactive_icons i").toHaveCount(2);
|
||||
await contains(":iframe .s_rating").click();
|
||||
await contains(".options-container [data-action-id='activeIconsNumber'] input").click();
|
||||
await clear();
|
||||
await fill("1");
|
||||
await animationFrame();
|
||||
expect(":iframe .s_rating .s_rating_active_icons i").toHaveCount(1);
|
||||
await contains(".options-container [data-action-id='totalIconsNumber'] input").click();
|
||||
await clear();
|
||||
await fill("4");
|
||||
await animationFrame();
|
||||
expect(":iframe .s_rating .s_rating_inactive_icons i").toHaveCount(3);
|
||||
expect(":iframe .s_rating").toHaveInnerHTML(
|
||||
`<strong class="s_rating_title">Quality</strong>
|
||||
<div class="s_rating_icons o_not_editable" contenteditable="false">
|
||||
<span class="s_rating_active_icons">
|
||||
<i class="fa fa-star" contenteditable="false">
|
||||
​
|
||||
</i>
|
||||
</span>
|
||||
<span class="s_rating_inactive_icons">
|
||||
<i class="fa fa-star-o" contenteditable="false">
|
||||
​
|
||||
</i>
|
||||
<i class="fa fa-star-o" contenteditable="false">
|
||||
​
|
||||
</i>
|
||||
<i class="fa fa-star-o" contenteditable="false">
|
||||
​
|
||||
</i>
|
||||
</span>
|
||||
</div>`
|
||||
);
|
||||
});
|
||||
test("Ensure order of operations when clicking very fast on two options", async () => {
|
||||
await setupHTMLBuilder(websiteContent);
|
||||
await contains(":iframe .s_rating").click();
|
||||
await waitFor("[data-label='Icon']");
|
||||
expect("[data-label='Icon'] .dropdown-toggle").toHaveText("Stars");
|
||||
expect(":iframe .s_rating").not.toHaveAttribute("data-active-custom-icon");
|
||||
await click(".options-container [data-action-id='customIcon']");
|
||||
await click(".options-container [data-class-action='fa-2x']");
|
||||
await animationFrame();
|
||||
expect(":iframe .s_rating_icons").not.toHaveClass("fa-2x");
|
||||
await contains(".modal-dialog .fa-glass").click();
|
||||
expect(":iframe .s_rating").toHaveAttribute("data-active-custom-icon", "fa fa-glass");
|
||||
expect("[data-label='Icon'] .dropdown-toggle").toHaveText("Custom");
|
||||
expect(":iframe .s_rating_icons").toHaveClass("fa-2x");
|
||||
await contains(".o-snippets-top-actions .fa-undo").click();
|
||||
expect("[data-label='Icon'] .dropdown-toggle").toHaveText("Custom");
|
||||
expect(":iframe .s_rating").toHaveAttribute("data-active-custom-icon", "fa fa-glass");
|
||||
expect(":iframe .s_rating_icons").not.toHaveClass("fa-2x");
|
||||
await contains(".o-snippets-top-actions .fa-undo").click();
|
||||
expect("[data-label='Icon'] .dropdown-toggle").toHaveText("Stars");
|
||||
expect(":iframe .s_rating").not.toHaveAttribute("data-active-custom-icon");
|
||||
expect(":iframe .s_rating_icons").not.toHaveClass("fa-2x");
|
||||
});
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
import { setupHTMLBuilder } from "@html_builder/../tests/helpers";
|
||||
import { expect, test, describe } from "@odoo/hoot";
|
||||
import { contains } from "@web/../tests/web_test_helpers";
|
||||
|
||||
describe.current.tags("desktop");
|
||||
|
||||
test("change width of separator", async () => {
|
||||
await setupHTMLBuilder(`
|
||||
<div class="s_hr">
|
||||
<hr class="w-100">
|
||||
</div>
|
||||
`);
|
||||
await contains(":iframe .s_hr").click();
|
||||
await contains("div:contains('Width') button:contains('100%')").click();
|
||||
expect("[data-class-action='mx-auto']").toHaveCount(0);
|
||||
await contains(".o_popover [data-class-action='w-50']").click();
|
||||
expect("[data-class-action='mx-auto']").toHaveCount(1);
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue