mirror of
https://github.com/bringout/oca-ocb-core.git
synced 2026-04-20 03:32:00 +02:00
vanilla 17.0
This commit is contained in:
parent
d72e748793
commit
a9bcec8e91
1986 changed files with 1613876 additions and 568976 deletions
|
|
@ -1,5 +1,5 @@
|
|||
/** @odoo-module **/
|
||||
import { click, legacyExtraNextTick } from "@web/../tests/helpers/utils";
|
||||
import { click, nextTick } from "@web/../tests/helpers/utils";
|
||||
import {
|
||||
createWebClient,
|
||||
doAction,
|
||||
|
|
@ -17,6 +17,7 @@ import { companyService } from "@web/webclient/company_service";
|
|||
let serverData;
|
||||
|
||||
const serviceRegistry = registry.category("services");
|
||||
const userMenuRegistry = registry.category("user_menuitems");
|
||||
|
||||
QUnit.module("Burger Menu", {
|
||||
beforeEach() {
|
||||
|
|
@ -59,9 +60,7 @@ QUnit.test("Burger Menu on an App", async (assert) => {
|
|||
|
||||
await createWebClient({ serverData });
|
||||
await click(document.body, ".o_navbar_apps_menu .dropdown-toggle");
|
||||
await legacyExtraNextTick();
|
||||
await click(document.body, ".o_app:nth-of-type(2)");
|
||||
await legacyExtraNextTick();
|
||||
|
||||
assert.containsNone(document.body, ".o_burger_menu");
|
||||
|
||||
|
|
@ -72,7 +71,7 @@ QUnit.test("Burger Menu on an App", async (assert) => {
|
|||
document.body.querySelector(".o_burger_menu nav.o_burger_menu_content li").textContent,
|
||||
"SubMenu"
|
||||
);
|
||||
assert.hasClass(document.body.querySelector(".o_burger_menu_content"), "o_burger_menu_dark");
|
||||
assert.hasClass(document.body.querySelector(".o_burger_menu_content"), "o_burger_menu_app");
|
||||
|
||||
await click(document.body, ".o_burger_menu_topbar");
|
||||
assert.doesNotHaveClass(
|
||||
|
|
@ -81,7 +80,7 @@ QUnit.test("Burger Menu on an App", async (assert) => {
|
|||
);
|
||||
|
||||
await click(document.body, ".o_burger_menu_topbar");
|
||||
assert.hasClass(document.body.querySelector(".o_burger_menu_content"), "o_burger_menu_dark");
|
||||
assert.hasClass(document.body.querySelector(".o_burger_menu_content"), "o_burger_menu_app");
|
||||
});
|
||||
|
||||
QUnit.test("Burger Menu on an App without SubMenu", async (assert) => {
|
||||
|
|
@ -89,9 +88,7 @@ QUnit.test("Burger Menu on an App without SubMenu", async (assert) => {
|
|||
|
||||
await createWebClient({ serverData });
|
||||
await click(document.body, ".o_navbar_apps_menu .dropdown-toggle");
|
||||
await legacyExtraNextTick();
|
||||
await click(document.body, ".o_app:nth-of-type(2)");
|
||||
await legacyExtraNextTick();
|
||||
|
||||
assert.containsNone(document.body, ".o_burger_menu");
|
||||
|
||||
|
|
@ -111,7 +108,6 @@ QUnit.test("Burger menu closes when an action is requested", async (assert) => {
|
|||
assert.containsOnce(document.body, ".o_burger_menu");
|
||||
|
||||
await doAction(wc, 1);
|
||||
await legacyExtraNextTick();
|
||||
assert.containsNone(document.body, ".o_burger_menu");
|
||||
assert.containsOnce(document.body, ".o_kanban_view");
|
||||
});
|
||||
|
|
@ -131,9 +127,7 @@ QUnit.test("Burger menu closes when click on menu item", async (assert) => {
|
|||
};
|
||||
await createWebClient({ serverData });
|
||||
await click(document.body, ".o_navbar_apps_menu .dropdown-toggle");
|
||||
await legacyExtraNextTick();
|
||||
await click(document.body, ".o_app:nth-of-type(2)");
|
||||
await legacyExtraNextTick();
|
||||
|
||||
assert.containsNone(document.body, ".o_burger_menu");
|
||||
|
||||
|
|
@ -144,7 +138,30 @@ QUnit.test("Burger menu closes when click on menu item", async (assert) => {
|
|||
"SubMenu"
|
||||
);
|
||||
await click(document.body, ".o_burger_menu nav.o_burger_menu_content li");
|
||||
await legacyExtraNextTick();
|
||||
await legacyExtraNextTick();
|
||||
await nextTick();
|
||||
assert.containsNone(document.body, ".o_burger_menu");
|
||||
});
|
||||
|
||||
QUnit.test("Burger menu closes when click on user menu item", async (assert) => {
|
||||
userMenuRegistry.add("ring_item", function () {
|
||||
return {
|
||||
type: "item",
|
||||
id: "ring",
|
||||
description: "Ring",
|
||||
callback: () => {
|
||||
assert.step("callback ring_item");
|
||||
},
|
||||
sequence: 5,
|
||||
};
|
||||
});
|
||||
await createWebClient({ serverData });
|
||||
|
||||
assert.containsNone(document.body, ".o_burger_menu");
|
||||
|
||||
await click(document.body, ".o_mobile_menu_toggle");
|
||||
assert.containsOnce(document.body, ".o_burger_menu");
|
||||
|
||||
await click(document.body, ".o_burger_menu .o_user_menu_mobile a");
|
||||
assert.containsNone(document.body, ".o_burger_menu");
|
||||
assert.verifySteps(["callback ring_item"]);
|
||||
});
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ import { userService } from "@web/core/user_service";
|
|||
import { makeTestEnv } from "@web/../tests/helpers/mock_env";
|
||||
import { makeFakeLocalizationService } from "@web/../tests/helpers/mock_services";
|
||||
import { click, getFixture, mount } from "@web/../tests/helpers/utils";
|
||||
import {markup} from "@odoo/owl";
|
||||
|
||||
const serviceRegistry = registry.category("services");
|
||||
const userMenuRegistry = registry.category("user_menuitems");
|
||||
|
|
@ -84,19 +85,30 @@ QUnit.test("can be rendered", async (assert) => {
|
|||
},
|
||||
};
|
||||
});
|
||||
userMenuRegistry.add("html_item", function () {
|
||||
return {
|
||||
type: "item",
|
||||
id: "html",
|
||||
description: markup(`<div>HTML<i class="fa fa-check px-2"></i></div>`),
|
||||
callback: () => {
|
||||
assert.step("callback html_item");
|
||||
},
|
||||
sequence: 20,
|
||||
};
|
||||
});
|
||||
await mount(BurgerUserMenu, target, { env });
|
||||
assert.containsN(target, ".o_user_menu_mobile .dropdown-item", 4);
|
||||
assert.containsN(target, ".o_user_menu_mobile .dropdown-item", 5);
|
||||
assert.containsOnce(target, ".o_user_menu_mobile .dropdown-item input.form-check-input");
|
||||
assert.containsOnce(target, "div.dropdown-divider");
|
||||
const children = [...(target.querySelector(".o_user_menu_mobile").children || [])];
|
||||
assert.deepEqual(
|
||||
children.map((el) => el.tagName),
|
||||
["A", "A", "DIV", "DIV", "A"]
|
||||
["A", "A", "DIV", "DIV", "A", "A"]
|
||||
);
|
||||
const items = [...target.querySelectorAll(".dropdown-item")] || [];
|
||||
assert.deepEqual(
|
||||
items.map((el) => el.textContent),
|
||||
["Ring", "Bad", "Frodo", "Eye"]
|
||||
["Ring", "Bad", "Frodo", "HTML", "Eye"]
|
||||
);
|
||||
for (const item of items) {
|
||||
click(item);
|
||||
|
|
@ -105,6 +117,7 @@ QUnit.test("can be rendered", async (assert) => {
|
|||
"callback ring_item",
|
||||
"callback bad_item",
|
||||
"callback frodo_item",
|
||||
"callback html_item",
|
||||
"callback eye_item",
|
||||
]);
|
||||
});
|
||||
|
|
|
|||
|
|
@ -49,36 +49,20 @@ QUnit.module("Mobile SettingsFormView", (hooks) => {
|
|||
serverData,
|
||||
arch: `
|
||||
<form string="Settings" class="oe_form_configuration o_base_settings" js_class="base_settings">
|
||||
<div class="o_setting_container">
|
||||
<div class="settings">
|
||||
<div class="app_settings_block" string="CRM" data-key="crm">
|
||||
<div class="row mt16 o_settings_container">
|
||||
<div class="col-12 col-lg-6 o_setting_box">
|
||||
<div class="o_setting_left_pane">
|
||||
<field name="bar"/>
|
||||
</div>
|
||||
<div class="o_setting_right_pane">
|
||||
<label for="bar"/>
|
||||
<div class="text-muted">this is bar</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="app_settings_block" string="Project" data-key="project">
|
||||
<div class="row mt16 o_settings_container">
|
||||
<div class="col-12 col-lg-6 o_setting_box">
|
||||
<div class="o_setting_left_pane">
|
||||
<field name="foo"/>
|
||||
</div>
|
||||
<div class="o_setting_right_pane">
|
||||
<label for="foo"/>
|
||||
<div class="text-muted">this is foo</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<app string="CRM" name="crm">
|
||||
<block>
|
||||
<setting help="this is bar">
|
||||
<field name="bar"/>
|
||||
</setting>
|
||||
</block>
|
||||
</app>
|
||||
<app string="Project" name="project">
|
||||
<block>
|
||||
<setting help="this is foo">
|
||||
<field name="foo"/>
|
||||
</setting>
|
||||
</block>
|
||||
</app>
|
||||
</form>`,
|
||||
});
|
||||
|
||||
|
|
@ -125,36 +109,20 @@ QUnit.module("Mobile SettingsFormView", (hooks) => {
|
|||
serverData,
|
||||
arch: `
|
||||
<form string="Settings" class="oe_form_configuration o_base_settings" js_class="base_settings">
|
||||
<div class="o_setting_container">
|
||||
<div class="settings">
|
||||
<div class="app_settings_block" string="CRM" data-key="crm">
|
||||
<div class="row mt16 o_settings_container">
|
||||
<div class="col-12 col-lg-6 o_setting_box">
|
||||
<div class="o_setting_left_pane">
|
||||
<field name="bar"/>
|
||||
</div>
|
||||
<div class="o_setting_right_pane">
|
||||
<label for="bar"/>
|
||||
<div class="text-muted">this is bar</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="app_settings_block" string="Project" data-key="project">
|
||||
<div class="row mt16 o_settings_container">
|
||||
<div class="col-12 col-lg-6 o_setting_box">
|
||||
<div class="o_setting_left_pane">
|
||||
<field name="foo"/>
|
||||
</div>
|
||||
<div class="o_setting_right_pane">
|
||||
<label for="foo"/>
|
||||
<div class="text-muted">this is foo</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<app string="CRM" name="crm">
|
||||
<block>
|
||||
<setting help="this is bar">
|
||||
<field name="bar"/>
|
||||
</setting>
|
||||
</block>
|
||||
</app>
|
||||
<app string="Project" name="project">
|
||||
<block>
|
||||
<setting help="this is foo">
|
||||
<field name="foo"/>
|
||||
</setting>
|
||||
</block>
|
||||
</app>
|
||||
</form>`,
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,67 @@
|
|||
/** @odoo-module **/
|
||||
|
||||
import { getFixture } from "@web/../tests/helpers/utils";
|
||||
import { setupViewRegistries } from "@web/../tests/views/helpers";
|
||||
import { createWebClient, doAction } from "@web/../tests/webclient/helpers";
|
||||
|
||||
let serverData, target;
|
||||
|
||||
QUnit.module("ActionManager", (hooks) => {
|
||||
hooks.beforeEach(() => {
|
||||
serverData = {
|
||||
models: {
|
||||
project: {
|
||||
fields: {
|
||||
foo: { string: "Foo", type: "boolean" },
|
||||
},
|
||||
records: [
|
||||
{
|
||||
id: 1,
|
||||
foo: true,
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
foo: false,
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
views: {
|
||||
"project,false,list": '<list><field name="foo"/></list>',
|
||||
"project,false,kanban": `
|
||||
<kanban>
|
||||
<templates>
|
||||
<t t-name='kanban-box'>
|
||||
<div class='oe_kanban_card'>
|
||||
<field name='foo' />
|
||||
</div>
|
||||
</t>
|
||||
</templates>
|
||||
</kanban>
|
||||
`,
|
||||
"project,false,search": "<search></search>",
|
||||
},
|
||||
};
|
||||
target = getFixture();
|
||||
setupViewRegistries();
|
||||
});
|
||||
|
||||
QUnit.module("Window Actions");
|
||||
|
||||
QUnit.test("execute a window action with mobile_view_mode", async (assert) => {
|
||||
const webClient = await createWebClient({ serverData });
|
||||
await doAction(webClient, {
|
||||
xml_id: "project.action",
|
||||
name: "Project Action",
|
||||
res_model: "project",
|
||||
type: "ir.actions.act_window",
|
||||
view_mode: "list,kanban",
|
||||
mobile_view_mode: "list",
|
||||
views: [
|
||||
[false, "kanban"],
|
||||
[false, "list"],
|
||||
],
|
||||
});
|
||||
assert.containsOnce(target, ".o_list_view");
|
||||
});
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue