summaryrefslogtreecommitdiff
path: root/addons/mail/static/src/components/attachment/attachment_tests.js
diff options
context:
space:
mode:
Diffstat (limited to 'addons/mail/static/src/components/attachment/attachment_tests.js')
-rw-r--r--addons/mail/static/src/components/attachment/attachment_tests.js88
1 files changed, 88 insertions, 0 deletions
diff --git a/addons/mail/static/src/components/attachment/attachment_tests.js b/addons/mail/static/src/components/attachment/attachment_tests.js
index 0698aafe227..302f39cd41a 100644
--- a/addons/mail/static/src/components/attachment/attachment_tests.js
+++ b/addons/mail/static/src/components/attachment/attachment_tests.js
@@ -667,6 +667,94 @@ QUnit.test('[technical] does not crash when the viewer is closed before image lo
}
});
+QUnit.test('plain text file is viewable', async function (assert) {
+ assert.expect(1);
+
+ await this.start();
+ const attachment = this.env.models['mail.attachment'].create({
+ filename: "test.txt",
+ id: 750,
+ mimetype: 'text/plain',
+ name: "test.txt",
+ });
+ await this.createAttachmentComponent(attachment, {
+ detailsMode: 'card',
+ isDownloadable: false,
+ isEditable: false,
+ });
+ assert.hasClass(
+ document.querySelector('.o_Attachment'),
+ 'o-viewable',
+ "should be viewable",
+ );
+});
+
+QUnit.test('HTML file is viewable', async function (assert) {
+ assert.expect(1);
+
+ await this.start();
+ const attachment = this.env.models['mail.attachment'].create({
+ filename: "test.html",
+ id: 750,
+ mimetype: 'text/html',
+ name: "test.html",
+ });
+ await this.createAttachmentComponent(attachment, {
+ detailsMode: 'card',
+ isDownloadable: false,
+ isEditable: false,
+ });
+ assert.hasClass(
+ document.querySelector('.o_Attachment'),
+ 'o-viewable',
+ "should be viewable",
+ );
+});
+
+QUnit.test('ODT file is not viewable', async function (assert) {
+ assert.expect(1);
+
+ await this.start();
+ const attachment = this.env.models['mail.attachment'].create({
+ filename: "test.odt",
+ id: 750,
+ mimetype: 'application/vnd.oasis.opendocument.text',
+ name: "test.odt",
+ });
+ await this.createAttachmentComponent(attachment, {
+ detailsMode: 'card',
+ isDownloadable: false,
+ isEditable: false,
+ });
+ assert.doesNotHaveClass(
+ document.querySelector('.o_Attachment'),
+ 'o-viewable',
+ "should not be viewable",
+ );
+});
+
+QUnit.test('DOCX file is not viewable', async function (assert) {
+ assert.expect(1);
+
+ await this.start();
+ const attachment = this.env.models['mail.attachment'].create({
+ filename: "test.docx",
+ id: 750,
+ mimetype: 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
+ name: "test.docx",
+ });
+ await this.createAttachmentComponent(attachment, {
+ detailsMode: 'card',
+ isDownloadable: false,
+ isEditable: false,
+ });
+ assert.doesNotHaveClass(
+ document.querySelector('.o_Attachment'),
+ 'o-viewable',
+ "should not be viewable",
+ );
+});
+
});
});
});