Commit 88388867 authored by Roque's avatar Roque

erp5_officejs_ui_test: update only office test to migration

parent b343b610
...@@ -11,12 +11,13 @@ ...@@ -11,12 +11,13 @@
}), }),
gadget = this; gadget = this;
return storage.put('bad_document', { return storage.put('bad_document', {
'filename': 'test.xlsx', 'reference': 'bad_document_ooffice_upload',
'title': 'Bad Document', 'title': 'Bad Document',
'filename': 'test.xlsx',
'portal_type': 'Spreadsheet', 'portal_type': 'Spreadsheet',
'mime_type': 'xlsx', 'parent_relative_url': "document_module",
'modification_date': 'Fri, 17 Aug 2018 11:21:22 +0000', 'content_type': "application/x-asc-spreadsheet",
'content_type': "application/x-asc-spreadsheet" 'modification_date': 'Fri, 17 Aug 2018 11:21:22 +0000'
}) })
.push(function (id) { .push(function (id) {
return jIO.util.ajax({ return jIO.util.ajax({
...@@ -42,6 +43,10 @@ ...@@ -42,6 +43,10 @@
var div = document.createElement('div'); var div = document.createElement('div');
div.textContent = 'Document Created'; div.textContent = 'Document Created';
gadget.element.appendChild(div); gadget.element.appendChild(div);
}, function (error) {
var div = document.createElement('div');
div.textContent = 'Error creating document: ' + error.message;
gadget.element.appendChild(div);
}); });
}); });
}(window, rJS, jIO, document, URL)); }(window, rJS, jIO, document, URL));
...@@ -4,10 +4,11 @@ ...@@ -4,10 +4,11 @@
"use strict"; "use strict";
function check(gadget, storage, format) { function check(gadget, storage, format) {
var output_message = "output_message not set - there was an error";
return new RSVP.Queue() return new RSVP.Queue()
.push(function () { .push(function () {
return RSVP.all([ return RSVP.all([
storage.getAttachment('test', format), storage.getAttachment('test', 'data'),
jIO.util.ajax({ jIO.util.ajax({
type: "GET", type: "GET",
url: new URL('./test_ooo_' + gadget.param.type + '.' + format, window.location.href), url: new URL('./test_ooo_' + gadget.param.type + '.' + format, window.location.href),
...@@ -20,13 +21,16 @@ ...@@ -20,13 +21,16 @@
jIO.util.readBlobAsText(result[0]), jIO.util.readBlobAsText(result[0]),
jIO.util.readBlobAsText(result[1].target.response) jIO.util.readBlobAsText(result[1].target.response)
]); ]);
}, function (error) {
output_message = 'ERROR converting document: ' + error.message;
}) })
.push(function (result) { .push(function (result) {
var div = window.document.createElement('div'); var div = window.document.createElement('div');
if (result[0].target.response == result[1].target.response) { if (result && result[0].target.response == result[1].target.response) {
div.textContent = 'Converted ' + format + ' OK'; output_message = 'Converted ' + format + ' OK';
gadget.element.appendChild(div);
} }
div.textContent = output_message;
gadget.element.appendChild(div);
}); });
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment