mirror of
https://github.com/bringout/oca-ocb-project.git
synced 2026-04-20 04:22:03 +02:00
19.0 vanilla
This commit is contained in:
parent
a2f74aefd8
commit
4a4d12c333
844 changed files with 212348 additions and 270090 deletions
|
|
@ -0,0 +1,124 @@
|
|||
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",
|
||||
});
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue