diff options
| author | Dharmraj Jhala <dja@openerp.com> | 2017-05-11 17:15:15 +0530 |
|---|---|---|
| committer | Géry Debongnie <ged@odoo.com> | 2017-07-12 13:43:08 +0200 |
| commit | 4330ea02676a4afd88707bb463a007e7de3c8686 (patch) | |
| tree | f547124a18fd30e09433a65cd9aa7b5a6645131a /addons/web/static/tests/widgets | |
| parent | 578edf73b9f637b0d27708c511b542a27bd7a3b8 (diff) | |
[ADD] web, *: add rainbowification
This commit introduces the 'rainbowification' feature to the web client
(and to some affected addons). This feature is essentially a way to
display a nice friendly message when some business event happens. For
example, a encouraging message is displayed when the user clear her/his
inbox, or when a salesman closes a deal.
The mechanism currently only displays a 'rainbowman', but could be
extended later to add other kind of animation.
There are a few different ways to display a 'rainbowman':
- any JS code can simply trigger_up an event ('show_effect') with some
options: for example
this.trigger_up('show_effect', {
type: 'rainbow_man',
fadeout: 'no',
message: $done,
click_close: false,
});
- an action returned by the server can have an 'effect' key, with some
options
- the do_execute_action method accepts a 'effect' option. This is
useful when one wants to specify a rainbow on an action button in a
form view
Joint work with: dbh <dbh@odoo.com>, ged <ged@odoo.com>
Diffstat (limited to 'addons/web/static/tests/widgets')
| -rw-r--r-- | addons/web/static/tests/widgets/rainbow_man_tests.js | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/addons/web/static/tests/widgets/rainbow_man_tests.js b/addons/web/static/tests/widgets/rainbow_man_tests.js new file mode 100644 index 00000000000..e9674ebc3fe --- /dev/null +++ b/addons/web/static/tests/widgets/rainbow_man_tests.js @@ -0,0 +1,37 @@ +odoo.define('web.rainbow_man_tests', function (require) { +"use strict"; + +var RainbowMan = require('web.rainbow_man'); + +QUnit.module('widgets', {}, function () { + +QUnit.module('RainbowMan', { + beforeEach: function () { + this.data = { + message: 'Congrats!', + click_close: false + }; + }, +}, function () { + + QUnit.test("rendering a rainbowman", function (assert) { + assert.expect(2); + + var $target = $("#qunit-fixture"); + + // Create and display rainbowman + var rainbowman = new RainbowMan(this.data); + rainbowman.appendTo($target); + + 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(); + }); +}); +}); +}); |
