Files
odoo_source/addons/web_tour/static/tests/debug_manager_tests.js
T
+2 318cdcc0b8 [REF] *: adapt code to owl 2
Owl 2 changelog: https://github.com/odoo/owl/blob/a9f29c4caad4f32d06be1ec4780572825781cd9b/CHANGELOG.md

Part-of: odoo/odoo#80156
Co-authored-by: Aaron Bohy <aab@odoo.com>
Co-authored-by: Bruno Boi <boi@odoo.com>
Co-authored-by: Géry Debongnie <ged@odoo.com>
Co-authored-by: Samuel Degueldre <sad@odoo.com>
Co-authored-by: Mathieu Duckerts-Antoine <dam@odoo.com>
Co-authored-by: Simon Genin (ges) <ges@odoo.com>
Co-authored-by: Francois (fge) <fge@odoo.com>
Co-authored-by: Michael Mattiello (mcm) <mcm@odoo.com>
Co-authored-by: Julien Mougenot <jum@odoo.com>
Co-authored-by: luvi <luvi@odoo.com>
Co-authored-by: Lucas Perais (lpe) <lpe@odoo.com>
Co-authored-by: Jorge Pinna Puissant <jpp@odoo.com>
2022-02-10 07:46:13 +00:00

69 lines
2.3 KiB
JavaScript

/** @odoo-module **/
import { disableTours } from "@web_tour/debug/debug_manager";
import { hotkeyService } from "@web/core/hotkeys/hotkey_service";
import { ormService } from "@web/core/orm_service";
import { registry } from "@web/core/registry";
import { uiService } from "@web/core/ui/ui_service";
import { click, getFixture, mount } from "@web/../tests/helpers/utils";
import { makeTestEnv } from "@web/../tests/helpers/mock_env";
import { makeFakeLocalizationService } from "@web/../tests/helpers/mock_services";
import { DebugMenuParent } from "@web/../tests/core/debug/debug_manager_tests";
import { fakeCommandService } from "@web/../tests/helpers/mock_services";
const debugRegistry = registry.category("debug");
let target;
QUnit.module("Tours", (hooks) => {
QUnit.module("DebugManager");
hooks.beforeEach(async () => {
target = getFixture();
registry
.category("services")
.add("hotkey", hotkeyService)
.add("ui", uiService)
.add("orm", ormService)
.add("localization", makeFakeLocalizationService())
.add("command", fakeCommandService);
});
QUnit.test("can disable tours", async (assert) => {
debugRegistry.category("default").add("disableTours", disableTours);
const fakeTourService = {
start(env) {
return {
getActiveTours() {
return [{ name: 'a' }, { name: 'b' }];
}
}
},
};
registry.category("services").add("tour", fakeTourService);
const mockRPC = async (route, args) => {
if (args.method === "check_access_rights") {
return Promise.resolve(true);
}
if (args.method === "consume") {
assert.step("consume");
assert.deepEqual(args.args[0], ['a', 'b']);
return Promise.resolve(true);
}
};
const env = await makeTestEnv({ mockRPC });
const debugManager = await mount(DebugMenuParent, target, { env });
await click(debugManager.el.querySelector("button.dropdown-toggle"));
assert.containsOnce(debugManager.el, ".dropdown-item");
await click(debugManager.el.querySelector(".dropdown-item"));
assert.verifySteps(["consume"]);
});
});