From ef5d777facddbb3209a6be246bbfd7f6b074992e Mon Sep 17 00:00:00 2001 From: Amine Ben hammou Date: Fri, 23 Feb 2018 15:23:37 +0100 Subject: [PATCH] fixing tests --- .../newsletter_editor/components/save.spec.js | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/tests/javascript/newsletter_editor/components/save.spec.js b/tests/javascript/newsletter_editor/components/save.spec.js index bdd70e3186..6eb7178289 100644 --- a/tests/javascript/newsletter_editor/components/save.spec.js +++ b/tests/javascript/newsletter_editor/components/save.spec.js @@ -172,12 +172,14 @@ define([ it('triggers template saving when clicked on "save as template" button', function () { var mock = sinon.mock({ post: function () {} }).expects('post').once().returns(jQuery.Deferred()); - var html2canvasMock = jQuery.Deferred(); + var promiseMock = {}; var module; - html2canvasMock.resolve({ - toDataURL: function () { return 'somedataurl'; } - }); + promiseMock.then = function (cb) { + cb(); + return promiseMock; + }; + promiseMock.catch = promiseMock.then; EditorApplication.getBody = sinon.stub(); EditorApplication.getNewsletter = function () { @@ -202,10 +204,10 @@ define([ trackEvent: function () {} }, 'newsletter_editor/App': EditorApplication, - html2canvas: function () { - return { - then: function () { return html2canvasMock; } - }; + 'common/thumbnail.jsx': { + fromNewsletter: function () { + return promiseMock; + } } }); view = new (module.SaveView)();