mirror of
https://github.com/bringout/oca-ocb-web.git
synced 2026-04-19 04:12:01 +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,80 @@
|
|||
import {
|
||||
addBuilderOption,
|
||||
addBuilderPlugin,
|
||||
setupHTMLBuilder,
|
||||
dummyBase64Img,
|
||||
} from "@html_builder/../tests/helpers";
|
||||
import { Plugin } from "@html_editor/plugin";
|
||||
import { expect, test, describe } from "@odoo/hoot";
|
||||
import { xml } from "@odoo/owl";
|
||||
import { contains, onRpc } from "@web/../tests/web_test_helpers";
|
||||
|
||||
describe.current.tags("desktop");
|
||||
|
||||
test("Do not set contenteditable to true on elements inside o_not_editable", async () => {
|
||||
class TestPlugin extends Plugin {
|
||||
static id = "testPlugin";
|
||||
resources = {
|
||||
force_editable_selector: ".target",
|
||||
};
|
||||
}
|
||||
addBuilderPlugin(TestPlugin);
|
||||
await setupHTMLBuilder(`
|
||||
<section>
|
||||
<div class="o_not_editable">
|
||||
<div class="target">
|
||||
Hello
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
`);
|
||||
expect(":iframe .target").not.toHaveAttribute("contenteditable", "true");
|
||||
});
|
||||
|
||||
test("Media should not be replaceable if not inside a savable zone", async () => {
|
||||
await setupHTMLBuilder("", {
|
||||
headerContent: `
|
||||
<header id="top" data-anchor="true" data-name="Header">
|
||||
<i class="fa fa-shopping-cart fa-stack target" data-oe-model="ir.ui.view" data-oe-id="786" data-oe-field="arch" data-oe-xpath="/data/xpath/li[1]/a[1]"/>
|
||||
</header>`,
|
||||
styleContent: `
|
||||
.fa {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
width: 0.75rem;
|
||||
height: 0.75rem;
|
||||
}
|
||||
`,
|
||||
});
|
||||
expect(":iframe .target").toHaveClass("o_editable_media");
|
||||
await contains(":iframe #wrapwrap .target").click();
|
||||
expect("span:contains('Double-click to edit')").toHaveCount(0);
|
||||
await contains(":iframe #wrapwrap .target").dblclick();
|
||||
expect(".modal-content:contains(Select a media)").toHaveCount(0);
|
||||
});
|
||||
|
||||
test("clone of editable media inside not editable area should be editable", async () => {
|
||||
onRpc("/html_editor/get_image_info", () => ({}));
|
||||
addBuilderOption({
|
||||
selector: "section",
|
||||
template: xml`<BuilderButton classAction="'test'">Test</BuilderButton>`,
|
||||
});
|
||||
addBuilderOption({
|
||||
selector: "img",
|
||||
template: xml`<BuilderButton classAction="'test'">Test Image</BuilderButton>`,
|
||||
});
|
||||
const { waitDomUpdated } = await setupHTMLBuilder(`
|
||||
<section>
|
||||
<div class="o_not_editable">
|
||||
<img class="o_editable_media" src="${dummyBase64Img}"/>
|
||||
</div>
|
||||
</section>
|
||||
`);
|
||||
await contains(":iframe img").click();
|
||||
await waitDomUpdated();
|
||||
expect(".options-container[data-container-title='Image']").toBeDisplayed();
|
||||
await contains(".oe_snippet_clone").click();
|
||||
await contains(":iframe section:last-of-type img").click();
|
||||
expect(".options-container[data-container-title='Image']").toBeDisplayed();
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue