[FIX] mail: do not fetch attachment style in QUnit tests
Task-2339931 closes odoo/odoo#57875 X-original-commit: 7586f7756859bb0711eee8a82bf728a039ad0d72 Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
This commit is contained in:
@@ -71,6 +71,12 @@ class Attachment extends Component {
|
||||
if (this.attachment.fileType !== 'image') {
|
||||
return '';
|
||||
}
|
||||
if (this.env.isQUnitTest) {
|
||||
// background-image:url is hardly mockable, and attachments in
|
||||
// QUnit tests do not actually exist in DB, so style should not
|
||||
// be fetched at all.
|
||||
return '';
|
||||
}
|
||||
let size;
|
||||
if (this.detailsMode === 'card') {
|
||||
size = '38x38';
|
||||
|
||||
+7
@@ -56,6 +56,13 @@ function addMessagingToEnv(providedEnv = {}) {
|
||||
}
|
||||
return this.messaging.isInitialized;
|
||||
},
|
||||
/**
|
||||
* States whether the environment is in QUnit test or not.
|
||||
*
|
||||
* Useful to prevent some behaviour in QUnit tests, like applying
|
||||
* style of attachment that uses url.
|
||||
*/
|
||||
isQUnitTest: true,
|
||||
loadingBaseDelayDuration: providedEnv.loadingBaseDelayDuration || 0,
|
||||
messaging: undefined,
|
||||
messagingCreatedPromise: makeDeferred(),
|
||||
|
||||
@@ -71,6 +71,13 @@ Object.assign(env, {
|
||||
}
|
||||
return this.messaging.isInitialized;
|
||||
},
|
||||
/**
|
||||
* States whether the environment is in QUnit test or not.
|
||||
*
|
||||
* Useful to prevent some behaviour in QUnit tests, like applying
|
||||
* style of attachment that uses url.
|
||||
*/
|
||||
isQUnitTest: false,
|
||||
loadingBaseDelayDuration: 400,
|
||||
messaging: undefined,
|
||||
messagingBus: new EventBus(),
|
||||
|
||||
Reference in New Issue
Block a user