diff options
| author | Christophe Matthieu <chm@odoo.com> | 2018-03-29 17:46:24 +0200 |
|---|---|---|
| committer | Géry Debongnie <ged@odoo.com> | 2018-04-19 17:17:54 +0200 |
| commit | 07cd24b1ecf3ab8edd3fffbf2fcd3a3e685f357c (patch) | |
| tree | 3fc6a94ed00c2501e83a102f07438ea87097fca8 /addons/web/static/tests/chrome/action_manager_tests.js | |
| parent | 67a7d1f2b5ec1cdc2fa6677a359fc6cf10f02b85 (diff) | |
[IMP] web: convert notification popup in service and add buttons params
this.call('web.Notification', 'notify', params)
Display a notification at the appropriate location, and returns the
reference id to the same widget. Note that this method does not wait
for the appendTo method to complete.
@param {Object} params
@param {string} params.title notification title
@param {string} params.message notification main message
@param {string} params.type 'notification' or 'warning'
@param {boolean} [params.sticky=false] if true, the notification will stay
visible until the user clicks on it.
@param {string} [params.className] className to add on the dom
@param {function} [params.onClose] callback when the user click on the x
or when the notification is auto close (no sticky)
@param {Array<Object>} params.buttons
@param {function} params.buttons[0].click callback on click
@param {Boolean} [params.buttons[0].primary] display the button as primary
@param {string} [params.buttons[0].text] button label
@param {string} [params.buttons[0].icon] font-awsome className or image src
@returns {Number} notification id
this.call('web.Notification', 'close', notificationId)
Diffstat (limited to 'addons/web/static/tests/chrome/action_manager_tests.js')
| -rw-r--r-- | addons/web/static/tests/chrome/action_manager_tests.js | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/addons/web/static/tests/chrome/action_manager_tests.js b/addons/web/static/tests/chrome/action_manager_tests.js index 350bf20a06a..656bc3b8e42 100644 --- a/addons/web/static/tests/chrome/action_manager_tests.js +++ b/addons/web/static/tests/chrome/action_manager_tests.js @@ -2,7 +2,7 @@ odoo.define('web.action_manager_tests', function (require) { "use strict"; var ReportClientAction = require('report.client_action'); - +var NotificationService = require('web.NotificationService'); var AbstractAction = require('web.AbstractAction'); var AbstractStorageService = require('web.AbstractStorageService'); var BasicFields = require('web.basic_fields'); @@ -1770,6 +1770,7 @@ QUnit.module('ActionManager', { assert.step(params.url); params.success(); params.complete(); + return true; }, }, }); @@ -1797,7 +1798,11 @@ QUnit.module('ActionManager', { actions: this.actions, archs: this.archs, data: this.data, - services: [ReportService], + services: [ReportService, NotificationService.extend({ + notify: function (params) { + assert.step(params.type || 'notification'); + } + })], mockRPC: function (route, args) { assert.step(args.method || route); if (route === '/report/check_wkhtmltopdf') { @@ -1810,11 +1815,7 @@ QUnit.module('ActionManager', { assert.step(params.url); params.success(); params.complete(); - }, - }, - intercepts: { - notification: function () { - assert.step('notification'); + return true; }, }, }); @@ -1851,7 +1852,11 @@ QUnit.module('ActionManager', { actions: this.actions, archs: this.archs, data: this.data, - services: [ReportService], + services: [ReportService, NotificationService.extend({ + notify: function (params) { + assert.step(params.type || 'notification'); + } + })], mockRPC: function (route, args) { assert.step(args.method || route); if (route === '/report/check_wkhtmltopdf') { @@ -1865,11 +1870,7 @@ QUnit.module('ActionManager', { session: { get_file: function (params) { assert.step(params.url); // should not be called - }, - }, - intercepts: { - notification: function () { - assert.step('notification'); + return true; }, }, }); |
