diff options
Diffstat (limited to 'web-ui/test')
-rw-r--r-- | web-ui/test/spec/mixins/with_mail_sandbox.spec.js | 30 |
1 files changed, 27 insertions, 3 deletions
diff --git a/web-ui/test/spec/mixins/with_mail_sandbox.spec.js b/web-ui/test/spec/mixins/with_mail_sandbox.spec.js index a1c2d624..daa8cc39 100644 --- a/web-ui/test/spec/mixins/with_mail_sandbox.spec.js +++ b/web-ui/test/spec/mixins/with_mail_sandbox.spec.js @@ -2,13 +2,37 @@ describeMixin('mixins/with_mail_sandbox', function() { 'use strict'; beforeEach(function() { - this.setupComponent('<iframe id="read-sandbox" sandbox="allow-popups allow-scripts" src="sandbox/sandbox.html" scrolling="no"></iframe>'); + this.setupComponent('<iframe id="read-sandbox" sandbox="allow-popups allow-scripts" src scrolling="no"></iframe>'); + var iframe = document.querySelector('iframe'); + var template = ['', + '<!DOCTYPE html>', + '<html>', + '<head>', + '<meta charset="utf-8">', + '<script>(function () {', + '\'use strict\'', + ';window.onmessage = function (e) {', + 'if (e.data.html) {', + 'var mainWindow = e.source;', + 'mainWindow.postMessage(\'data ok\', e.origin);', + '}', + '};', + '})();', + '</script>', + '</head>', + '<body>', + '</body>', + '</html>'].join(''); + iframe.src = URL.createObjectURL(new Blob([template], {type: "text/html"})); }); - it('should open reply container', function () { + it('should open reply container', function (done) { var showContainerEvent = spyOnEvent(document, Pixelated.events.ui.replyBox.showReplyContainer); this.component.showMailOnSandbox(Pixelated.testData().parsedMail.html); - expect(showContainerEvent).toHaveBeenTriggeredOn(document); + setTimeout(function() { + expect(showContainerEvent).toHaveBeenTriggeredOn(document); + done(); + }, 200); }); }); |