Files
goodie/frontend/project/static/tests/project_right_side_panel.test.js
Marc 8741282322 Eliminate Python dependency: embed frontend assets in odoo-go
- Copy all OWL frontend assets (JS/CSS/XML/fonts/images) into frontend/
  directory (2925 files, 43MB) — no more runtime reads from Python Odoo
- Replace OdooAddonsPath config with FrontendDir pointing to local frontend/
- Rewire bundle.go, static.go, templates.go, webclient.go to read from
  frontend/ instead of external Python Odoo addons directory
- Auto-detect frontend/ and build/ dirs relative to binary in main.go
- Delete obsolete Python helper scripts (tools/*.py)

The Go server is now fully self-contained: single binary + frontend/ folder.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-31 23:09:12 +02:00

125 lines
3.3 KiB
JavaScript

import { expect, test, describe } from "@odoo/hoot";
import { queryAll } from "@odoo/hoot-dom";
import { mountWithCleanup, onRpc } from "@web/../tests/web_test_helpers";
import { defineMailModels } from "@mail/../tests/mail_test_helpers";
import { ProjectRightSidePanel } from "@project/components/project_right_side_panel/project_right_side_panel";
defineMailModels();
describe.current.tags("desktop");
const FAKE_DATA = {
user: {
is_project_user: true,
},
buttons: [
{
icon: "check",
text: "Tasks",
number: "0 / 0",
action_type: "object",
action: "action_view_tasks",
show: true,
sequence: 1,
},
],
show_project_profitability_helper: false,
show_milestones: true,
milestones: {
data: [
{
id: 1,
name: "Milestone Zero",
},
],
},
profitability_items: {
costs: {
data: [],
},
revenues: {
data: [],
},
},
};
test("Right side panel will not be rendered without data and settings set false", async () => {
onRpc(() => {
const deepCopy = JSON.parse(JSON.stringify(FAKE_DATA));
deepCopy.buttons.pop();
deepCopy.milestones.data.pop();
deepCopy.show_milestones = false;
return { ...deepCopy };
});
await mountWithCleanup(ProjectRightSidePanel, {
props: {
context: { active_id: 1 },
domain: new Array(),
},
});
expect(queryAll("div.o_rightpanel").length).toBe(0, {
message: "Right panel should not be rendered",
});
});
test("Right side panel will be rendered if settings are turned on but doesnt have any data", async () => {
onRpc(() => {
const deepCopy = JSON.parse(JSON.stringify(FAKE_DATA));
deepCopy.buttons.pop();
deepCopy.milestones.data.pop();
deepCopy.show_milestones = true;
return { ...deepCopy };
});
await mountWithCleanup(ProjectRightSidePanel, {
props: {
context: { active_id: 1 },
domain: new Array(),
},
});
expect(queryAll("div.o_rightpanel").length).toBe(1, {
message: "Right panel should be rendered",
});
});
test("Right side panel will be not rendered if settings are turned off but does have data", async () => {
onRpc(() => {
const deepCopy = JSON.parse(JSON.stringify(FAKE_DATA));
deepCopy.show_milestones = false;
return { ...deepCopy };
});
await mountWithCleanup(ProjectRightSidePanel, {
props: {
context: { active_id: 1 },
domain: new Array(),
},
});
expect(queryAll("div.o_rightpanel").length).toBe(0, {
message: "Right panel should not be rendered",
});
});
test("Right side panel will be rendered if both setting is turned on and does have data", async () => {
onRpc(() => {
return { ...FAKE_DATA };
});
await mountWithCleanup(ProjectRightSidePanel, {
props: {
context: { active_id: 1 },
domain: new Array(),
},
});
expect(queryAll("div.o_rightpanel").length).toBe(1, {
message: "Right panel should be rendered",
});
});