[FIX] web_tour: display rainbowman at end of tours

Since commit [1], it crashed when, at the end of a tour, we tried
to display a rainbow man, because we forgot to update the "type"
key.

74dc3f654ee5849982b494e46eefb1fc2b4e0c74

closes odoo/odoo#77306

X-original-commit: 6fa92d38e1945414f45411fc2e2528a8ef6f9fd1
Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com>
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
This commit is contained in:
Aaron Bohy
2021-09-28 10:53:29 +00:00
parent 79bb85364a
commit 4efa1b209c
2 changed files with 38 additions and 1 deletions
@@ -434,7 +434,7 @@ return core.Class.extend(mixins.EventDispatcherMixin, ServicesMixin, {
}
const fadeout = this.tours[tour_name].fadeout;
core.bus.trigger('show-effect', {
type: "rainbowman",
type: "rainbow_man",
message,
fadeout,
messageIsHtml: true,
@@ -1,6 +1,7 @@
odoo.define('web_tour.tour_manager_tests', async function (require) {
"use strict";
const core = require("web.core");
const KanbanView = require('web.KanbanView');
const TourManager = require('web_tour.TourManager');
const testUtils = require('web.test_utils');
@@ -72,6 +73,42 @@ odoo.define('web_tour.tour_manager_tests', async function (require) {
tourManager.destroy();
});
QUnit.test("Displays a rainbow man by default at the end of tours", async function (assert) {
assert.expect(3);
function onShowEffect(params) {
assert.deepEqual(params, {
fadeout: "medium",
message: "<strong><b>Good job!</b> You went through all steps of this tour.</strong>",
messageIsHtml: true,
type: "rainbow_man"
});
}
core.bus.on("show-effect", null, onShowEffect);
const tourManager = await createTourManager({
data: { 'web_tour.tour': { fields: {}, consume() {} } },
template: `<button class="btn anchor">Anchor</button>`,
tours: [{
name: "Some tour",
options: {},
steps: [{ trigger: '.anchor', content: "anchor" }],
}],
// Use this test in "debug" mode because the tips need to be in
// the viewport to be able to test their normal content
// (otherwise, the tips would indicate to the users that they
// have to scroll).
debug: true,
});
assert.containsOnce(document.body, '.o_tooltip');
await testUtils.dom.click($('.anchor'));
assert.containsNone(document.body, '.o_tooltip');
tourManager.destroy();
core.bus.off("show-effect", onShowEffect);
});
QUnit.test("Click on invisible tip consumes it", async function (assert) {
assert.expect(5);