This rev. makes the Rainbowman stop listening to event 'clear_uncommitted_changes' on core.bus, as this event is about to be removed (in a next commit). It was using it to destroy itself when such an event was triggered (basically, when the current view was left). Instead, we removed the option 'click_close' as, when set to true, which was the default, the rainbowman was destroyed as soon as the user clicked outside the raibowman.
40 lines
1.0 KiB
JavaScript
40 lines
1.0 KiB
JavaScript
odoo.define('web.RainbowMan_tests', function (require) {
|
|
"use strict";
|
|
|
|
var RainbowMan = require('web.RainbowMan');
|
|
|
|
QUnit.module('widgets', {}, function () {
|
|
|
|
QUnit.module('RainbowMan', {
|
|
beforeEach: function () {
|
|
this.data = {
|
|
message: 'Congrats!',
|
|
};
|
|
},
|
|
}, function () {
|
|
|
|
QUnit.test("rendering a rainbowman", function (assert) {
|
|
var done = assert.async();
|
|
assert.expect(2);
|
|
|
|
var $target = $("#qunit-fixture");
|
|
|
|
// Create and display rainbowman
|
|
var rainbowman = new RainbowMan(this.data);
|
|
rainbowman.appendTo($target).then(function () {
|
|
var $rainbow = rainbowman.$(".o_reward_rainbow");
|
|
assert.strictEqual($rainbow.length, 1,
|
|
"Should have displayed rainbow effect");
|
|
|
|
assert.ok(rainbowman.$('.o_reward_msg_content').html() === 'Congrats!',
|
|
"Card on the rainbowman should display 'Congrats!' message");
|
|
|
|
rainbowman.destroy();
|
|
done();
|
|
});
|
|
|
|
});
|
|
});
|
|
});
|
|
});
|