[FIX] mail: fix potential issues with notification request
This patch was previously defined globally, but it has been removed at some point. This absence prevents from running some tests that relied on it when the current browser value does not match what the test is expecting. Part of task-2810734 Part-of: odoo/odoo#92193
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
|
||||
import { registerModel } from '@mail/model/model_core';
|
||||
import { attr, one } from '@mail/model/model_field';
|
||||
import { clear } from '@mail/model/model_field_command';
|
||||
|
||||
import { sprintf } from '@web/core/utils/strings';
|
||||
|
||||
@@ -11,9 +12,12 @@ registerModel({
|
||||
recordMethods: {
|
||||
/**
|
||||
* @private
|
||||
* @returns {string}
|
||||
* @returns {string|FieldCommand}
|
||||
*/
|
||||
_computeHeaderText() {
|
||||
if (!this.messaging.partnerRoot) {
|
||||
return clear();
|
||||
}
|
||||
return sprintf(
|
||||
this.env._t("%(odoobotName)s has a request"),
|
||||
{ odoobotName: this.messaging.partnerRoot.nameOrDisplayName },
|
||||
|
||||
@@ -109,6 +109,12 @@ QUnit.test('messaging becomes initialized', async function (assert) {
|
||||
QUnit.test('basic rendering', async function (assert) {
|
||||
assert.expect(21);
|
||||
|
||||
patchWithCleanup(browser, {
|
||||
Notification: {
|
||||
...browser.Notification,
|
||||
permission: 'denied',
|
||||
},
|
||||
});
|
||||
const { click, createMessagingMenuComponent } = await start();
|
||||
await createMessagingMenuComponent();
|
||||
assert.strictEqual(
|
||||
@@ -234,6 +240,12 @@ QUnit.test('basic rendering', async function (assert) {
|
||||
QUnit.test('counter is taking into account failure notification', async function (assert) {
|
||||
assert.expect(2);
|
||||
|
||||
patchWithCleanup(browser, {
|
||||
Notification: {
|
||||
...browser.Notification,
|
||||
permission: 'denied',
|
||||
},
|
||||
});
|
||||
const pyEnv = await startServer();
|
||||
const mailChannelId1 = pyEnv['mail.channel'].create();
|
||||
const mailMessageId1 = pyEnv['mail.message'].create({
|
||||
|
||||
@@ -2,6 +2,9 @@
|
||||
|
||||
import { start } from '@mail/../tests/helpers/test_utils';
|
||||
|
||||
import { browser } from '@web/core/browser/browser';
|
||||
import { patchWithCleanup } from '@web/../tests/helpers/utils';
|
||||
|
||||
QUnit.module('mail', {}, function () {
|
||||
QUnit.module('models', {}, function () {
|
||||
QUnit.module('messaging_menu_tests.js');
|
||||
@@ -9,6 +12,12 @@ QUnit.module('messaging_menu_tests.js');
|
||||
QUnit.test('messaging menu counter should ignore unread messages in channels that are unpinned', async function (assert) {
|
||||
assert.expect(1);
|
||||
|
||||
patchWithCleanup(browser, {
|
||||
Notification: {
|
||||
...browser.Notification,
|
||||
permission: 'denied',
|
||||
},
|
||||
});
|
||||
const { messaging } = await start();
|
||||
messaging.models['Thread'].create({
|
||||
id: 31,
|
||||
|
||||
@@ -18,7 +18,10 @@ QUnit.skip('notification_alert widget: display blocked notification alert', asyn
|
||||
assert.expect(1);
|
||||
|
||||
patchWithCleanup(browser, {
|
||||
Notification: 'denied',
|
||||
Notification: {
|
||||
...browser.Notification,
|
||||
permission: 'denied',
|
||||
},
|
||||
});
|
||||
await start({
|
||||
arch: `
|
||||
|
||||
Reference in New Issue
Block a user