diff options
| author | ThanhDodeurOdoo <tso@odoo.com> | 2018-11-07 14:52:33 +0000 |
|---|---|---|
| committer | ThanhDodeurOdoo <tso@odoo.com> | 2018-12-06 19:09:33 +0000 |
| commit | 89f20d2c297d99d4eb0ded8be78fbf86b8ec45d3 (patch) | |
| tree | c86e3d9085425ef7aa9ddf4dcdd453b766a0b90f /addons/mail/static/tests | |
| parent | 72905feee0b5393f8872e51b33a10e4ec7978085 (diff) | |
[REF] base, mail: splits the documents feature from ir attachment
Moved the field 'active', 'res_model_name' and 'thumbnail' from
ir.attachment to enterprise's documents.document.
Moved the pdf split feature to enterprise's Documents module.
task: #1908896
Diffstat (limited to 'addons/mail/static/tests')
| -rw-r--r-- | addons/mail/static/tests/chatter_tests.js | 4 | ||||
| -rw-r--r-- | addons/mail/static/tests/document_viewer_tests.js | 42 |
2 files changed, 7 insertions, 39 deletions
diff --git a/addons/mail/static/tests/chatter_tests.js b/addons/mail/static/tests/chatter_tests.js index 470b6045797..ac9f715be5d 100644 --- a/addons/mail/static/tests/chatter_tests.js +++ b/addons/mail/static/tests/chatter_tests.js @@ -1445,11 +1445,11 @@ QUnit.test('chatter: Attachment viewer', function (assert) { "image caption should have correct download link"); // click on first image attachement testUtils.dom.click(form.$('.o_thread_message .o_attachment .o_image_box .o_image_overlay').first()); - assert.strictEqual($('.o_modal_fullscreen img.o_viewer_img[data-src="/web/image/1?unique=1&signature=999"]').length, 1, + assert.strictEqual($('.o_modal_fullscreen img.o_viewer_img[data-src="/web/image/1?unique=1&signature=999&model=ir.attachment"]').length, 1, "Modal popup should open with first image src"); // click on next button testUtils.dom.click($('.modal .arrow.arrow-right.move_next span')); - assert.strictEqual($('.o_modal_fullscreen img.o_viewer_img[data-src="/web/image/2?unique=1&signature=999"]').length, 1, + assert.strictEqual($('.o_modal_fullscreen img.o_viewer_img[data-src="/web/image/2?unique=1&signature=999&model=ir.attachment"]').length, 1, "Modal popup should have now second image src"); assert.strictEqual($('.o_modal_fullscreen .o_viewer_toolbar .o_download_btn').length, 1, "Modal popup should have download button"); diff --git a/addons/mail/static/tests/document_viewer_tests.js b/addons/mail/static/tests/document_viewer_tests.js index ef825f84e2a..87fa2dbed94 100644 --- a/addons/mail/static/tests/document_viewer_tests.js +++ b/addons/mail/static/tests/document_viewer_tests.js @@ -19,16 +19,16 @@ var createViewer = function (params) { var viewer = new DocumentViewer(parent, params.attachments, params.attachmentID); var mockRPC = function (route) { - if (route === '/web/static/lib/pdfjs/web/viewer.html?file=/web/content/1') { + if (route === '/web/static/lib/pdfjs/web/viewer.html?file=/web/content/1?model%3Dir.attachment') { return $.when(); } if (route === 'https://www.youtube.com/embed/FYqW0Gdwbzk') { return $.when(); } - if (route === '/web/content/4') { + if (route === '/web/content/4?model%3Dir.attachment') { return $.when(); } - if (route === '/web/image/6?unique=1&signature=999') { + if (route === '/web/image/6?unique=1&signature=999&model=ir.attachment') { return $.when(); } }; @@ -100,38 +100,6 @@ QUnit.module('DocumentViewer', { viewer.destroy(); }); - QUnit.test('Document Viewer PDF', function (assert) { - assert.expect(6); - - var viewer = createViewer({ - attachmentID: 1, - attachments: this.attachments, - mockRPC: function (route, args) { - if (args.method === 'split_pdf') { - assert.deepEqual(args.args, [1, "", false], "should have the right arguments"); - return $.when(); - } - return this._super.apply(this, arguments); - }, - intercepts: { - document_viewer_attachment_changed: function () { - assert.ok(true, "should trigger document_viewer_attachment_changed event"); - } - }, - }); - - assert.containsOnce(viewer, '.o_page_number_input', - "pdf should have a page input"); - assert.containsOnce(viewer, '.o_remainder_input', - "pdf should have a remainder checkbox"); - assert.containsOnce(viewer, '.o_split_btn', - "pdf should have a split button"); - - testUtils.dom.click(viewer.$('.o_split_btn')); - - assert.ok(viewer.isDestroyed(), 'viewer should be destroyed'); - }); - QUnit.test('Document Viewer Youtube', function (assert) { assert.expect(3); @@ -165,7 +133,7 @@ QUnit.module('DocumentViewer', { assert.strictEqual(viewer.$(".o_image_caption:contains('text.html')").length, 1, "the viewer be on the right attachment"); - assert.containsOnce(viewer, 'iframe[data-src="/web/content/4"]', + assert.containsOnce(viewer, 'iframe[data-src="/web/content/4?model%3Dir.attachment"]', "there should be an iframe with the right src"); viewer.destroy(); @@ -197,7 +165,7 @@ QUnit.module('DocumentViewer', { assert.strictEqual(viewer.$(".o_image_caption:contains('image.jpg')").length, 1, "the viewer be on the right attachment"); - assert.containsOnce(viewer, 'img[data-src="/web/image/6?unique=1&signature=999"]', + assert.containsOnce(viewer, 'img[data-src="/web/image/6?unique=1&signature=999&model=ir.attachment"]', "there should be a video player"); viewer.destroy(); |
