fixing js tests
This commit is contained in:
@@ -93,18 +93,16 @@ define([
|
||||
};
|
||||
|
||||
Module.saveTemplate = function (options) {
|
||||
var categories = [
|
||||
'saved',
|
||||
App.getNewsletter().get('type')
|
||||
];
|
||||
var promise = jQuery.Deferred();
|
||||
|
||||
return Module.getThumbnail(
|
||||
jQuery('#mailpoet_editor_content > .mailpoet_block').get(0)
|
||||
).then(function (thumbnail) {
|
||||
promise.then(function (thumbnail) {
|
||||
var data = _.extend(options || {}, {
|
||||
thumbnail: thumbnail.toDataURL('image/jpeg'),
|
||||
body: JSON.stringify(App.getBody()),
|
||||
categories: JSON.stringify(categories)
|
||||
categories: JSON.stringify([
|
||||
'saved',
|
||||
App.getNewsletter().get('type')
|
||||
])
|
||||
});
|
||||
|
||||
return MailPoet.Ajax.post({
|
||||
@@ -114,6 +112,14 @@ define([
|
||||
data: data
|
||||
});
|
||||
});
|
||||
|
||||
Module.getThumbnail(
|
||||
jQuery('#mailpoet_editor_content > .mailpoet_block').get(0)
|
||||
).then(function (thumbnail) {
|
||||
promise.resolve(thumbnail);
|
||||
});
|
||||
|
||||
return promise;
|
||||
};
|
||||
|
||||
Module.exportTemplate = function (options) {
|
||||
|
@@ -143,6 +143,13 @@ define([
|
||||
});
|
||||
|
||||
EditorApplication.getBody = sinon.stub();
|
||||
EditorApplication.getNewsletter = function () {
|
||||
return {
|
||||
get: function () {
|
||||
return 'standard';
|
||||
}
|
||||
};
|
||||
};
|
||||
module = SaveInjector({
|
||||
mailpoet: {
|
||||
Ajax: {
|
||||
|
Reference in New Issue
Block a user