Tests space-before-function-paren
This commit is contained in:
@ -18,7 +18,6 @@
|
||||
"no-shadow": 0,
|
||||
"padded-blocks": 0,
|
||||
"object-curly-spacing": 0,
|
||||
"func-names": 0,
|
||||
"space-before-function-paren": 0
|
||||
"func-names": 0
|
||||
}
|
||||
}
|
||||
|
@ -52,9 +52,9 @@ global.interact = function () {
|
||||
styleCursor: global.interact
|
||||
};
|
||||
};
|
||||
global.spectrum = function() { return this; };
|
||||
global.spectrum = function () { return this; };
|
||||
jQuery.fn.spectrum = global.spectrum;
|
||||
jQuery.fn.stick_in_parent = function() { return this; };
|
||||
jQuery.fn.stick_in_parent = function () { return this; };
|
||||
|
||||
// Add global stubs for convenience
|
||||
// TODO: Extract those to a separate file
|
||||
@ -78,18 +78,18 @@ global.stubAvailableStyles = function (EditorApplication, styles) {
|
||||
App.getAvailableStyles = sinon.stub().returns(new global.Backbone.SuperModel(styles || {}));
|
||||
};
|
||||
|
||||
global.stubImage = function(defaultWidth, defaultHeight) {
|
||||
global.Image = function() {
|
||||
this.onload = function() {};
|
||||
global.stubImage = function (defaultWidth, defaultHeight) {
|
||||
global.Image = function () {
|
||||
this.onload = function () {};
|
||||
this.naturalWidth = defaultWidth;
|
||||
this.naturalHeight = defaultHeight;
|
||||
this.address = '';
|
||||
|
||||
Object.defineProperty(this, 'src', {
|
||||
get: function() {
|
||||
get: function () {
|
||||
return this.address;
|
||||
},
|
||||
set: function(src) {
|
||||
set: function (src) {
|
||||
this.address = src;
|
||||
this.onload();
|
||||
}
|
||||
|
@ -9,7 +9,7 @@ define([
|
||||
'newsletter_editor/blocks/container',
|
||||
'amd-inject-loader!newsletter_editor/blocks/automatedLatestContent',
|
||||
'newsletter_editor/components/communication'
|
||||
], function(
|
||||
], function (
|
||||
App,
|
||||
AutomatedLatestContentBlock,
|
||||
ContainerBlock,
|
||||
@ -19,19 +19,19 @@ define([
|
||||
var EditorApplication = App;
|
||||
var CommunicationComponent = Communication;
|
||||
|
||||
describe('Automated Latest Content Supervisor', function() {
|
||||
describe('Automated Latest Content Supervisor', function () {
|
||||
var model;
|
||||
var mock;
|
||||
var module;
|
||||
beforeEach(function() {
|
||||
beforeEach(function () {
|
||||
model = new AutomatedLatestContentBlock.ALCSupervisor();
|
||||
});
|
||||
|
||||
it('fetches posts in bulk from the server', function() {
|
||||
it('fetches posts in bulk from the server', function () {
|
||||
global.stubChannel(EditorApplication);
|
||||
EditorApplication.findModels = sinon.stub().returns([new Backbone.SuperModel()]);
|
||||
|
||||
mock = sinon.mock({ getBulkTransformedPosts: function() {} })
|
||||
mock = sinon.mock({ getBulkTransformedPosts: function () {} })
|
||||
.expects('getBulkTransformedPosts').once().returns(jQuery.Deferred());
|
||||
|
||||
module = AutomatedLatestContentInjector({
|
||||
@ -46,7 +46,7 @@ define([
|
||||
mock.verify();
|
||||
});
|
||||
|
||||
it('refreshes posts for given blocks', function() {
|
||||
it('refreshes posts for given blocks', function () {
|
||||
var block1 = new Backbone.SuperModel();
|
||||
var block2 = new Backbone.SuperModel();
|
||||
var postsSet1 = [
|
||||
@ -74,7 +74,7 @@ define([
|
||||
var model;
|
||||
var module;
|
||||
|
||||
before(function() {
|
||||
before(function () {
|
||||
module = AutomatedLatestContentBlock;
|
||||
});
|
||||
|
||||
@ -254,7 +254,7 @@ define([
|
||||
expect(model.get('divider.styles.block.padding')).to.equal('38px');
|
||||
});
|
||||
|
||||
it('accepts displayable posts', function() {
|
||||
it('accepts displayable posts', function () {
|
||||
var model;
|
||||
EditorApplication.getBlockTypeModel = sinon.stub().returns(ContainerBlock.ContainerBlockModel);
|
||||
model = new (module.AutomatedLatestContentBlockModel)();
|
||||
@ -273,7 +273,7 @@ define([
|
||||
var view;
|
||||
var module;
|
||||
|
||||
before(function() {
|
||||
before(function () {
|
||||
module = AutomatedLatestContentBlock;
|
||||
});
|
||||
|
||||
@ -334,10 +334,10 @@ define([
|
||||
var view;
|
||||
var module;
|
||||
|
||||
before(function() {
|
||||
before(function () {
|
||||
module = AutomatedLatestContentInjector({
|
||||
'newsletter_editor/components/communication': {
|
||||
getPostTypes: function() {
|
||||
getPostTypes: function () {
|
||||
return jQuery.Deferred();
|
||||
}
|
||||
}
|
||||
@ -345,7 +345,7 @@ define([
|
||||
});
|
||||
|
||||
before(function () {
|
||||
CommunicationComponent.getPostTypes = function() {
|
||||
CommunicationComponent.getPostTypes = function () {
|
||||
var deferred = jQuery.Deferred();
|
||||
deferred.resolve([
|
||||
{
|
||||
@ -378,7 +378,7 @@ define([
|
||||
EditorApplication.getBlockTypeView = sinon.stub().returns(Backbone.View);
|
||||
});
|
||||
|
||||
beforeEach(function() {
|
||||
beforeEach(function () {
|
||||
model = new (module.AutomatedLatestContentBlockModel)();
|
||||
view = new (module.AutomatedLatestContentBlockSettingsView)({model: model});
|
||||
});
|
||||
@ -392,7 +392,7 @@ define([
|
||||
});
|
||||
|
||||
describe('once rendered', function () {
|
||||
beforeEach(function() {
|
||||
beforeEach(function () {
|
||||
model = new (module.AutomatedLatestContentBlockModel)();
|
||||
view = new (module.AutomatedLatestContentBlockSettingsView)({model: model});
|
||||
view.render();
|
||||
@ -500,10 +500,10 @@ define([
|
||||
expect(model.get('showDivider')).to.equal(newValue);
|
||||
});
|
||||
|
||||
describe('when "title only" display type is selected', function() {
|
||||
describe('when "title only" display type is selected', function () {
|
||||
var model;
|
||||
var view;
|
||||
beforeEach(function() {
|
||||
beforeEach(function () {
|
||||
model = new (module.AutomatedLatestContentBlockModel)();
|
||||
view = new (module.AutomatedLatestContentBlockSettingsView)({model: model});
|
||||
view.render();
|
||||
@ -514,10 +514,10 @@ define([
|
||||
expect(view.$('.mailpoet_automated_latest_content_title_as_list')).to.not.have.$class('mailpoet_hidden');
|
||||
});
|
||||
|
||||
describe('when "title as list" is selected', function() {
|
||||
describe('when "title as list" is selected', function () {
|
||||
var model;
|
||||
var view;
|
||||
beforeEach(function() {
|
||||
beforeEach(function () {
|
||||
model = new (module.AutomatedLatestContentBlockModel)();
|
||||
view = new (module.AutomatedLatestContentBlockSettingsView)({model: model});
|
||||
view.render();
|
||||
@ -530,14 +530,14 @@ define([
|
||||
expect(view.$('.mailpoet_automated_latest_content_title_as_link')).to.have.$class('mailpoet_hidden');
|
||||
});
|
||||
|
||||
it('is set to "yes"', function() {
|
||||
it('is set to "yes"', function () {
|
||||
expect(model.get('titleIsLink')).to.equal(true);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('when "title as list" is deselected', function() {
|
||||
before(function() {
|
||||
describe('when "title as list" is deselected', function () {
|
||||
before(function () {
|
||||
view.$('.mailpoet_automated_latest_content_title_format').val('ul').change();
|
||||
view.$('.mailpoet_automated_latest_content_title_format').val('h3').change();
|
||||
});
|
||||
|
@ -4,7 +4,7 @@ const sinon = global.sinon;
|
||||
define([
|
||||
'newsletter_editor/App',
|
||||
'newsletter_editor/blocks/button'
|
||||
], function(App, ButtonBlock) {
|
||||
], function (App, ButtonBlock) {
|
||||
var EditorApplication = App;
|
||||
|
||||
describe('Button', function () {
|
||||
@ -322,7 +322,7 @@ define([
|
||||
describe('once rendered', function () {
|
||||
var model;
|
||||
var view;
|
||||
before(function() {
|
||||
before(function () {
|
||||
global.stubChannel(EditorApplication);
|
||||
global.stubConfig(EditorApplication);
|
||||
global.stubAvailableStyles(EditorApplication, {
|
||||
@ -331,7 +331,7 @@ define([
|
||||
});
|
||||
});
|
||||
|
||||
beforeEach(function() {
|
||||
beforeEach(function () {
|
||||
model = new (ButtonBlock.ButtonBlockModel)({
|
||||
type: 'button',
|
||||
text: 'Some random text'
|
||||
@ -453,7 +453,7 @@ define([
|
||||
expect(view.$('.mailpoet_field_button_line_height_input').val()).to.equal('37');
|
||||
});
|
||||
|
||||
it('does not display link option when `hideLink` option is active', function() {
|
||||
it('does not display link option when `hideLink` option is active', function () {
|
||||
view = new (ButtonBlock.ButtonBlockSettingsView)({
|
||||
model: model,
|
||||
renderOptions: {
|
||||
@ -464,7 +464,7 @@ define([
|
||||
expect(view.$('.mailpoet_field_button_url').length).to.equal(0);
|
||||
});
|
||||
|
||||
it('does not display "Apply to all" option when `hideApplyToAll` option is active', function() {
|
||||
it('does not display "Apply to all" option when `hideApplyToAll` option is active', function () {
|
||||
view = new (ButtonBlock.ButtonBlockSettingsView)({
|
||||
model: model,
|
||||
renderOptions: {
|
||||
|
@ -5,7 +5,7 @@ const Backbone = global.Backbone;
|
||||
define([
|
||||
'newsletter_editor/App',
|
||||
'newsletter_editor/blocks/container'
|
||||
], function(App, ContainerBlock) {
|
||||
], function (App, ContainerBlock) {
|
||||
var EditorApplication = App;
|
||||
|
||||
describe('Container', function () {
|
||||
@ -205,7 +205,7 @@ define([
|
||||
describe('once rendered', function () {
|
||||
var model;
|
||||
var view;
|
||||
beforeEach(function() {
|
||||
beforeEach(function () {
|
||||
global.stubChannel(EditorApplication);
|
||||
global.stubAvailableStyles(EditorApplication);
|
||||
model = new (ContainerBlock.ContainerBlockModel)();
|
||||
|
@ -4,7 +4,7 @@ const sinon = global.sinon;
|
||||
define([
|
||||
'newsletter_editor/App',
|
||||
'newsletter_editor/blocks/divider'
|
||||
], function(App, DividerBlock) {
|
||||
], function (App, DividerBlock) {
|
||||
var EditorApplication = App;
|
||||
|
||||
describe('Divider', function () {
|
||||
@ -157,7 +157,7 @@ define([
|
||||
var model;
|
||||
var view;
|
||||
|
||||
before(function() {
|
||||
before(function () {
|
||||
global.stubChannel(EditorApplication);
|
||||
global.stubAvailableStyles(EditorApplication, {
|
||||
dividers: ['solid', 'inset']
|
||||
@ -200,13 +200,13 @@ define([
|
||||
expect(model.get('styles.block.backgroundColor')).to.equal('#cccccc');
|
||||
});
|
||||
|
||||
it('changes color of available divider styles when actual divider color changes', function() {
|
||||
it('changes color of available divider styles when actual divider color changes', function () {
|
||||
var newColor = '#889912';
|
||||
view.$('.mailpoet_field_divider_border_color').val(newColor).change();
|
||||
expect(view.$('.mailpoet_field_divider_style div')).to.have.$css('border-top-color', newColor);
|
||||
});
|
||||
|
||||
it('does not display "Apply to all" option when `hideApplyToAll` option is active', function() {
|
||||
it('does not display "Apply to all" option when `hideApplyToAll` option is active', function () {
|
||||
view = new (DividerBlock.DividerBlockSettingsView)({
|
||||
model: model,
|
||||
renderOptions: {
|
||||
|
@ -4,7 +4,7 @@ const sinon = global.sinon;
|
||||
define([
|
||||
'newsletter_editor/App',
|
||||
'newsletter_editor/blocks/footer'
|
||||
], function(App, FooterBlock) {
|
||||
], function (App, FooterBlock) {
|
||||
var EditorApplication = App;
|
||||
|
||||
describe('Footer', function () {
|
||||
@ -155,7 +155,7 @@ define([
|
||||
var model;
|
||||
var view;
|
||||
|
||||
beforeEach(function() {
|
||||
beforeEach(function () {
|
||||
global.stubChannel(EditorApplication);
|
||||
global.stubAvailableStyles(EditorApplication, {
|
||||
fonts: ['Arial', 'Tahoma'],
|
||||
|
@ -4,7 +4,7 @@ const sinon = global.sinon;
|
||||
define([
|
||||
'newsletter_editor/App',
|
||||
'newsletter_editor/blocks/header'
|
||||
], function(App, HeaderBlock) {
|
||||
], function (App, HeaderBlock) {
|
||||
var EditorApplication = App;
|
||||
|
||||
describe('Header', function () {
|
||||
@ -155,7 +155,7 @@ define([
|
||||
var model;
|
||||
var view;
|
||||
|
||||
beforeEach(function() {
|
||||
beforeEach(function () {
|
||||
global.stubChannel(EditorApplication);
|
||||
global.stubAvailableStyles(EditorApplication, {
|
||||
fonts: ['Arial', 'Tahoma'],
|
||||
|
@ -4,7 +4,7 @@ const sinon = global.sinon;
|
||||
define([
|
||||
'newsletter_editor/App',
|
||||
'newsletter_editor/blocks/image'
|
||||
], function(App, ImageBlock) {
|
||||
], function (App, ImageBlock) {
|
||||
var EditorApplication = App;
|
||||
|
||||
describe('Image', function () {
|
||||
|
@ -8,7 +8,7 @@ define([
|
||||
'newsletter_editor/components/communication',
|
||||
'newsletter_editor/blocks/posts',
|
||||
'newsletter_editor/blocks/container'
|
||||
], function(App, Communication, PostsBlock, ContainerBlock) {
|
||||
], function (App, Communication, PostsBlock, ContainerBlock) {
|
||||
var EditorApplication = App;
|
||||
var CommunicationComponent = Communication;
|
||||
|
||||
@ -24,8 +24,8 @@ define([
|
||||
describe('model', function () {
|
||||
var model;
|
||||
|
||||
before(function() {
|
||||
CommunicationComponent.getPosts = function() {
|
||||
before(function () {
|
||||
CommunicationComponent.getPosts = function () {
|
||||
var deferred = jQuery.Deferred();
|
||||
return deferred;
|
||||
};
|
||||
@ -238,7 +238,7 @@ define([
|
||||
});
|
||||
|
||||
it('triggers loading and loaded events for more posts', function () {
|
||||
var stub = sinon.stub(CommunicationComponent, 'getPosts', function() {
|
||||
var stub = sinon.stub(CommunicationComponent, 'getPosts', function () {
|
||||
var deferred = jQuery.Deferred();
|
||||
deferred.resolve([{}]); // 1 post
|
||||
return deferred;
|
||||
@ -291,7 +291,7 @@ define([
|
||||
var view;
|
||||
|
||||
before(function () {
|
||||
CommunicationComponent.getPostTypes = function() {
|
||||
CommunicationComponent.getPostTypes = function () {
|
||||
var deferred = jQuery.Deferred();
|
||||
deferred.resolve([
|
||||
{
|
||||
@ -423,10 +423,10 @@ define([
|
||||
expect(model.get('readMoreText')).to.equal(newValue);
|
||||
});
|
||||
|
||||
describe('when "title only" display type is selected', function() {
|
||||
describe('when "title only" display type is selected', function () {
|
||||
var model;
|
||||
var view;
|
||||
beforeEach(function() {
|
||||
beforeEach(function () {
|
||||
model = new (PostsBlock.PostsBlockModel)();
|
||||
model.request = sinon.stub().returns({$el: {}});
|
||||
view = new (PostsBlock.PostsBlockSettingsView)({model: model});
|
||||
@ -438,8 +438,8 @@ define([
|
||||
expect(view.$('.mailpoet_posts_title_as_list')).to.not.have.$class('mailpoet_hidden');
|
||||
});
|
||||
|
||||
describe('when "title as list" is selected', function() {
|
||||
beforeEach(function() {
|
||||
describe('when "title as list" is selected', function () {
|
||||
beforeEach(function () {
|
||||
view.$('.mailpoet_posts_display_type').val('titleOnly').change();
|
||||
view.$('.mailpoet_posts_title_format').val('ul').change();
|
||||
});
|
||||
@ -449,14 +449,14 @@ define([
|
||||
expect(view.$('.mailpoet_posts_title_as_link')).to.have.$class('mailpoet_hidden');
|
||||
});
|
||||
|
||||
it('is set to "yes"', function() {
|
||||
it('is set to "yes"', function () {
|
||||
expect(model.get('titleIsLink')).to.equal(true);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('when "title as list" is deselected', function() {
|
||||
before(function() {
|
||||
describe('when "title as list" is deselected', function () {
|
||||
before(function () {
|
||||
view.$('.mailpoet_posts_title_format').val('ul').change();
|
||||
view.$('.mailpoet_posts_title_format').val('h3').change();
|
||||
});
|
||||
|
@ -5,7 +5,7 @@ define([
|
||||
'newsletter_editor/App',
|
||||
'newsletter_editor/blocks/social',
|
||||
'backbone'
|
||||
], function(EditorApplication, SocialBlock, Backbone) {
|
||||
], function (EditorApplication, SocialBlock, Backbone) {
|
||||
|
||||
describe('Social', function () {
|
||||
describe('block model', function () {
|
||||
@ -257,18 +257,18 @@ define([
|
||||
view.render();
|
||||
});
|
||||
|
||||
it('updates icons in settings if iconset changes', function() {
|
||||
it('updates icons in settings if iconset changes', function () {
|
||||
view.$('.mailpoet_social_icon_set').last().click();
|
||||
expect(view.$('.mailpoet_social_icon_field_image').val()).to.equal(EditorApplication.getAvailableStyles().get('socialIconSets.light.custom'));
|
||||
});
|
||||
|
||||
it('removes the icon when "remove" is clicked', function() {
|
||||
it('removes the icon when "remove" is clicked', function () {
|
||||
view.$('.mailpoet_delete_block').click();
|
||||
expect(model.get('icons').length).to.equal(0);
|
||||
expect(view.$('.mailpoet_social_icon_settings').length).to.equal(0);
|
||||
});
|
||||
|
||||
it('adds another icon when "Add another social network" is pressed', function() {
|
||||
it('adds another icon when "Add another social network" is pressed', function () {
|
||||
view.$('.mailpoet_add_social_icon').click();
|
||||
expect(model.get('icons').length).to.equal(2);
|
||||
});
|
||||
|
@ -4,7 +4,7 @@ const sinon = global.sinon;
|
||||
define([
|
||||
'newsletter_editor/App',
|
||||
'newsletter_editor/blocks/spacer'
|
||||
], function(App, SpacerBlock) {
|
||||
], function (App, SpacerBlock) {
|
||||
var EditorApplication = App;
|
||||
|
||||
describe('Spacer', function () {
|
||||
@ -139,7 +139,7 @@ define([
|
||||
describe('once rendered', function () {
|
||||
var view;
|
||||
var model;
|
||||
beforeEach(function() {
|
||||
beforeEach(function () {
|
||||
global.stubChannel(EditorApplication);
|
||||
global.stubConfig(EditorApplication);
|
||||
model = new (SpacerBlock.SpacerBlockModel)();
|
||||
|
@ -3,7 +3,7 @@ const expect = global.expect;
|
||||
define([
|
||||
'newsletter_editor/App',
|
||||
'newsletter_editor/blocks/text'
|
||||
], function(EditorApplication, TextBlock) {
|
||||
], function (EditorApplication, TextBlock) {
|
||||
|
||||
describe('Text', function () {
|
||||
describe('model', function () {
|
||||
|
@ -6,14 +6,14 @@ define([
|
||||
'newsletter_editor/App',
|
||||
'newsletter_editor/components/communication',
|
||||
'amd-inject-loader!newsletter_editor/components/communication'
|
||||
], function(EditorApplication, Communication, CommunicationInjector) {
|
||||
], function (EditorApplication, Communication, CommunicationInjector) {
|
||||
|
||||
describe('getPostTypes', function() {
|
||||
it('fetches post types from the server', function() {
|
||||
describe('getPostTypes', function () {
|
||||
it('fetches post types from the server', function () {
|
||||
var module = CommunicationInjector({
|
||||
mailpoet: {
|
||||
Ajax: {
|
||||
post: function() {
|
||||
post: function () {
|
||||
var deferred = jQuery.Deferred();
|
||||
deferred.resolve({
|
||||
data: {
|
||||
@ -26,14 +26,14 @@ define([
|
||||
}
|
||||
}
|
||||
});
|
||||
module.getPostTypes().done(function(types) {
|
||||
module.getPostTypes().done(function (types) {
|
||||
expect(types).to.eql(['val1', 'val2']);
|
||||
});
|
||||
});
|
||||
|
||||
it('caches results', function() {
|
||||
it('caches results', function () {
|
||||
var deferred = jQuery.Deferred();
|
||||
var mock = sinon.mock({ post: function() {} }).expects('post').once().returns(deferred);
|
||||
var mock = sinon.mock({ post: function () {} }).expects('post').once().returns(deferred);
|
||||
var module = CommunicationInjector({
|
||||
mailpoet: {
|
||||
Ajax: {
|
||||
@ -52,10 +52,10 @@ define([
|
||||
});
|
||||
});
|
||||
|
||||
describe('getTaxonomies', function() {
|
||||
it('sends post type to endpoint', function() {
|
||||
describe('getTaxonomies', function () {
|
||||
it('sends post type to endpoint', function () {
|
||||
var spy;
|
||||
var post = function() {
|
||||
var post = function () {
|
||||
var deferred = jQuery.Deferred();
|
||||
deferred.resolve({
|
||||
category: 'val1',
|
||||
@ -77,11 +77,11 @@ define([
|
||||
expect(spy.args[0][0].data.postType).to.equal('post');
|
||||
});
|
||||
|
||||
it('fetches taxonomies from the server', function() {
|
||||
it('fetches taxonomies from the server', function () {
|
||||
var module = CommunicationInjector({
|
||||
mailpoet: {
|
||||
Ajax: {
|
||||
post: function() {
|
||||
post: function () {
|
||||
var deferred = jQuery.Deferred();
|
||||
deferred.resolve({
|
||||
data: {
|
||||
@ -93,14 +93,14 @@ define([
|
||||
}
|
||||
}
|
||||
});
|
||||
module.getTaxonomies('page').done(function(types) {
|
||||
module.getTaxonomies('page').done(function (types) {
|
||||
expect(types).to.eql({ category: 'val1' });
|
||||
});
|
||||
});
|
||||
|
||||
it('caches results', function() {
|
||||
it('caches results', function () {
|
||||
var deferred = jQuery.Deferred();
|
||||
var mock = sinon.mock({ post: function() {} }).expects('post').once().returns(deferred);
|
||||
var mock = sinon.mock({ post: function () {} }).expects('post').once().returns(deferred);
|
||||
var module = CommunicationInjector({
|
||||
mailpoet: {
|
||||
Ajax: {
|
||||
@ -116,10 +116,10 @@ define([
|
||||
});
|
||||
});
|
||||
|
||||
describe('getTerms', function() {
|
||||
it('sends terms to endpoint', function() {
|
||||
describe('getTerms', function () {
|
||||
it('sends terms to endpoint', function () {
|
||||
var spy;
|
||||
var post = function() {
|
||||
var post = function () {
|
||||
var deferred = jQuery.Deferred();
|
||||
deferred.resolve({});
|
||||
return deferred;
|
||||
@ -140,11 +140,11 @@ define([
|
||||
expect(spy.args[0][0].data.taxonomies).to.eql(['category', 'post_tag']);
|
||||
});
|
||||
|
||||
it('fetches terms from the server', function() {
|
||||
it('fetches terms from the server', function () {
|
||||
var module = CommunicationInjector({
|
||||
mailpoet: {
|
||||
Ajax: {
|
||||
post: function() {
|
||||
post: function () {
|
||||
var deferred = jQuery.Deferred();
|
||||
deferred.resolve({
|
||||
data: {
|
||||
@ -157,14 +157,14 @@ define([
|
||||
}
|
||||
}
|
||||
});
|
||||
module.getTerms({ taxonomies: ['category'] }).done(function(types) {
|
||||
module.getTerms({ taxonomies: ['category'] }).done(function (types) {
|
||||
expect(types).to.eql({ term1: 'term1val1', term2: 'term2val2' });
|
||||
});
|
||||
});
|
||||
|
||||
it('caches results', function() {
|
||||
it('caches results', function () {
|
||||
var deferred = jQuery.Deferred();
|
||||
var mock = sinon.mock({ post: function() {} }).expects('post').once().returns(deferred);
|
||||
var mock = sinon.mock({ post: function () {} }).expects('post').once().returns(deferred);
|
||||
var module = CommunicationInjector({
|
||||
mailpoet: {
|
||||
Ajax: {
|
||||
@ -180,10 +180,10 @@ define([
|
||||
});
|
||||
});
|
||||
|
||||
describe('getPosts', function() {
|
||||
it('sends options to endpoint', function() {
|
||||
describe('getPosts', function () {
|
||||
it('sends options to endpoint', function () {
|
||||
var spy;
|
||||
var post = function() {
|
||||
var post = function () {
|
||||
var deferred = jQuery.Deferred();
|
||||
deferred.resolve({});
|
||||
return deferred;
|
||||
@ -208,11 +208,11 @@ define([
|
||||
});
|
||||
});
|
||||
|
||||
it('fetches posts from the server', function() {
|
||||
it('fetches posts from the server', function () {
|
||||
var module = CommunicationInjector({
|
||||
mailpoet: {
|
||||
Ajax: {
|
||||
post: function() {
|
||||
post: function () {
|
||||
var deferred = jQuery.Deferred();
|
||||
deferred.resolve({
|
||||
data: [
|
||||
@ -225,14 +225,14 @@ define([
|
||||
}
|
||||
}
|
||||
});
|
||||
module.getPosts().done(function(posts) {
|
||||
module.getPosts().done(function (posts) {
|
||||
expect(posts).to.eql([{post_title: 'title 1'}, {post_title: 'post title 2'}]);
|
||||
});
|
||||
});
|
||||
|
||||
it('caches results', function() {
|
||||
it('caches results', function () {
|
||||
var deferred = jQuery.Deferred();
|
||||
var mock = sinon.mock({ post: function() {} }).expects('post').once().returns(deferred);
|
||||
var mock = sinon.mock({ post: function () {} }).expects('post').once().returns(deferred);
|
||||
var module = CommunicationInjector({
|
||||
mailpoet: {
|
||||
Ajax: {
|
||||
@ -251,10 +251,10 @@ define([
|
||||
});
|
||||
});
|
||||
|
||||
describe('getTransformedPosts', function() {
|
||||
it('sends options to endpoint', function() {
|
||||
describe('getTransformedPosts', function () {
|
||||
it('sends options to endpoint', function () {
|
||||
var spy;
|
||||
var post = function() {
|
||||
var post = function () {
|
||||
var deferred = jQuery.Deferred();
|
||||
deferred.resolve({});
|
||||
return deferred;
|
||||
@ -279,11 +279,11 @@ define([
|
||||
});
|
||||
});
|
||||
|
||||
it('fetches transformed posts from the server', function() {
|
||||
it('fetches transformed posts from the server', function () {
|
||||
var module = CommunicationInjector({
|
||||
mailpoet: {
|
||||
Ajax: {
|
||||
post: function() {
|
||||
post: function () {
|
||||
var deferred = jQuery.Deferred();
|
||||
deferred.resolve({
|
||||
data: [
|
||||
@ -296,14 +296,14 @@ define([
|
||||
}
|
||||
}
|
||||
});
|
||||
module.getTransformedPosts().done(function(posts) {
|
||||
module.getTransformedPosts().done(function (posts) {
|
||||
expect(posts).to.eql([{type: 'text', text: 'something'}, {type: 'text', text: 'something else'}]);
|
||||
});
|
||||
});
|
||||
|
||||
it('caches results', function() {
|
||||
it('caches results', function () {
|
||||
var deferred = jQuery.Deferred();
|
||||
var mock = sinon.mock({ post: function() {} }).expects('post').once().returns(deferred);
|
||||
var mock = sinon.mock({ post: function () {} }).expects('post').once().returns(deferred);
|
||||
var module = CommunicationInjector({
|
||||
mailpoet: {
|
||||
Ajax: {
|
||||
|
@ -3,10 +3,10 @@ const expect = global.expect;
|
||||
define([
|
||||
'newsletter_editor/App',
|
||||
'newsletter_editor/components/config'
|
||||
], function(EditorApplication, ConfigComponent) {
|
||||
], function (EditorApplication, ConfigComponent) {
|
||||
|
||||
describe('Config', function () {
|
||||
it('loads and stores configuration', function() {
|
||||
it('loads and stores configuration', function () {
|
||||
var model;
|
||||
ConfigComponent.setConfig({
|
||||
testConfig: 'testValue'
|
||||
|
@ -6,14 +6,14 @@ const _ = global._;
|
||||
define([
|
||||
'newsletter_editor/App',
|
||||
'newsletter_editor/components/content'
|
||||
], function(App, ContentComponent) {
|
||||
], function (App, ContentComponent) {
|
||||
var EditorApplication = App;
|
||||
|
||||
describe('Content', function() {
|
||||
describe('newsletter model', function() {
|
||||
describe('Content', function () {
|
||||
describe('newsletter model', function () {
|
||||
var model;
|
||||
|
||||
beforeEach(function() {
|
||||
beforeEach(function () {
|
||||
model = new (ContentComponent.NewsletterModel)({
|
||||
body: {
|
||||
globalStyles: {
|
||||
@ -29,8 +29,8 @@ define([
|
||||
});
|
||||
});
|
||||
|
||||
it('triggers autosave on change', function() {
|
||||
var mock = sinon.mock({ trigger: function() {} }).expects('trigger').once().withArgs('autoSave');
|
||||
it('triggers autosave on change', function () {
|
||||
var mock = sinon.mock({ trigger: function () {} }).expects('trigger').once().withArgs('autoSave');
|
||||
global.stubChannel(EditorApplication, {
|
||||
trigger: mock
|
||||
});
|
||||
@ -38,13 +38,13 @@ define([
|
||||
mock.verify();
|
||||
});
|
||||
|
||||
it('does not include styles and content properties in its JSON', function() {
|
||||
it('does not include styles and content properties in its JSON', function () {
|
||||
var json = model.toJSON();
|
||||
expect(json).to.deep.equal({subject: 'my test subject'});
|
||||
});
|
||||
|
||||
describe('toJSON()', function() {
|
||||
it('will only contain properties modifiable by the editor', function() {
|
||||
describe('toJSON()', function () {
|
||||
it('will only contain properties modifiable by the editor', function () {
|
||||
var model = new (ContentComponent.NewsletterModel)({
|
||||
id: 19,
|
||||
subject: 'some subject',
|
||||
@ -63,8 +63,8 @@ define([
|
||||
});
|
||||
});
|
||||
|
||||
describe('block types', function() {
|
||||
it('registers a block type view and model', function() {
|
||||
describe('block types', function () {
|
||||
it('registers a block type view and model', function () {
|
||||
var blockModel = new Backbone.SuperModel();
|
||||
var blockView = new Backbone.View();
|
||||
ContentComponent.registerBlockType('testType', {
|
||||
@ -76,8 +76,8 @@ define([
|
||||
});
|
||||
});
|
||||
|
||||
describe('transformation to json', function() {
|
||||
it('includes content, globalStyles and initial newsletter fields', function() {
|
||||
describe('transformation to json', function () {
|
||||
it('includes content, globalStyles and initial newsletter fields', function () {
|
||||
var json;
|
||||
var dataField = {
|
||||
containerModelField: 'containerModelValue'
|
||||
@ -89,20 +89,20 @@ define([
|
||||
subject: 'test newsletter subject'
|
||||
};
|
||||
EditorApplication._contentContainer = {
|
||||
toJSON: function() {
|
||||
toJSON: function () {
|
||||
return dataField;
|
||||
}
|
||||
};
|
||||
EditorApplication.getGlobalStyles = function() {
|
||||
EditorApplication.getGlobalStyles = function () {
|
||||
return {
|
||||
toJSON: function() {
|
||||
toJSON: function () {
|
||||
return stylesField;
|
||||
}
|
||||
};
|
||||
};
|
||||
EditorApplication.getNewsletter = function() {
|
||||
EditorApplication.getNewsletter = function () {
|
||||
return {
|
||||
toJSON: function() {
|
||||
toJSON: function () {
|
||||
return newsletterFields;
|
||||
}
|
||||
};
|
||||
|
@ -4,12 +4,12 @@ const Backbone = global.Backbone;
|
||||
define([
|
||||
'newsletter_editor/App',
|
||||
'newsletter_editor/components/heading'
|
||||
], function(EditorApplication, HeadingComponent) {
|
||||
], function (EditorApplication, HeadingComponent) {
|
||||
|
||||
describe('Heading', function() {
|
||||
describe('view', function() {
|
||||
describe('Heading', function () {
|
||||
describe('view', function () {
|
||||
var view;
|
||||
beforeEach(function() {
|
||||
beforeEach(function () {
|
||||
var model = new Backbone.SuperModel({
|
||||
subject: 'a test subject'
|
||||
});
|
||||
@ -18,14 +18,14 @@ define([
|
||||
});
|
||||
});
|
||||
|
||||
it('renders', function() {
|
||||
it('renders', function () {
|
||||
expect(view.render).to.not.throw();
|
||||
});
|
||||
|
||||
describe('once rendered', function() {
|
||||
describe('once rendered', function () {
|
||||
var view;
|
||||
var model;
|
||||
beforeEach(function() {
|
||||
beforeEach(function () {
|
||||
model = new Backbone.SuperModel({
|
||||
subject: 'a test subject',
|
||||
preheader: 'a test preheader'
|
||||
@ -36,12 +36,12 @@ define([
|
||||
view.render();
|
||||
});
|
||||
|
||||
it('changes the model when subject field is changed', function() {
|
||||
it('changes the model when subject field is changed', function () {
|
||||
view.$('.mailpoet_input_title').val('a new testing subject').keyup();
|
||||
expect(model.get('subject')).to.equal('a new testing subject');
|
||||
});
|
||||
|
||||
it('changes the model when preheader field is changed', function() {
|
||||
it('changes the model when preheader field is changed', function () {
|
||||
view.$('.mailpoet_input_preheader').val('a new testing preheader').keyup();
|
||||
expect(model.get('preheader')).to.equal('a new testing preheader');
|
||||
});
|
||||
|
@ -6,23 +6,23 @@ define([
|
||||
'newsletter_editor/components/save',
|
||||
'amd-inject-loader!newsletter_editor/components/save',
|
||||
'jquery'
|
||||
], function(App, SaveComponent, SaveInjector, jQuery) {
|
||||
], function (App, SaveComponent, SaveInjector, jQuery) {
|
||||
var EditorApplication = App;
|
||||
|
||||
describe('Save', function() {
|
||||
describe('save method', function() {
|
||||
describe('Save', function () {
|
||||
describe('save method', function () {
|
||||
var module;
|
||||
before(function() {
|
||||
before(function () {
|
||||
module = SaveInjector({
|
||||
'newsletter_editor/components/communication': {
|
||||
saveNewsletter: function() {
|
||||
saveNewsletter: function () {
|
||||
return jQuery.Deferred();
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
it('triggers beforeEditorSave event', function() {
|
||||
it('triggers beforeEditorSave event', function () {
|
||||
var spy = sinon.spy();
|
||||
global.stubChannel(EditorApplication, {
|
||||
trigger: spy
|
||||
@ -37,7 +37,7 @@ define([
|
||||
expect(spy).to.have.been.calledWith('beforeEditorSave');
|
||||
});
|
||||
|
||||
it('triggers afterEditorSave event', function() {
|
||||
it('triggers afterEditorSave event', function () {
|
||||
var module;
|
||||
var spy = sinon.spy();
|
||||
var promise = jQuery.Deferred();
|
||||
@ -59,7 +59,7 @@ define([
|
||||
expect(spy.withArgs('afterEditorSave').calledOnce).to.be.true;// eslint-disable-line no-unused-expressions
|
||||
});
|
||||
|
||||
it('sends newsletter json to server for saving', function() {
|
||||
it('sends newsletter json to server for saving', function () {
|
||||
var mock = sinon.mock().once().returns(jQuery.Deferred());
|
||||
var module = SaveInjector({
|
||||
'newsletter_editor/components/communication': {
|
||||
@ -74,7 +74,7 @@ define([
|
||||
mock.verify();
|
||||
});
|
||||
|
||||
it('encodes newsletter body in JSON format', function() {
|
||||
it('encodes newsletter body in JSON format', function () {
|
||||
var module;
|
||||
var body = {type: 'testType'};
|
||||
var mock = sinon.mock()
|
||||
@ -100,28 +100,28 @@ define([
|
||||
|
||||
});
|
||||
|
||||
describe('view', function() {
|
||||
describe('view', function () {
|
||||
var view;
|
||||
before(function() {
|
||||
before(function () {
|
||||
EditorApplication._contentContainer = { isValid: sinon.stub().returns(true) };
|
||||
global.stubConfig(EditorApplication);
|
||||
view = new (SaveComponent.SaveView)();
|
||||
});
|
||||
|
||||
it('renders', function() {
|
||||
it('renders', function () {
|
||||
expect(view.render).to.not.throw();
|
||||
});
|
||||
|
||||
describe('once rendered', function() {
|
||||
describe('once rendered', function () {
|
||||
var view;
|
||||
beforeEach(function() {
|
||||
beforeEach(function () {
|
||||
EditorApplication._contentContainer = { isValid: sinon.stub().returns(true) };
|
||||
view = new (SaveComponent.SaveView)();
|
||||
view.render();
|
||||
});
|
||||
|
||||
it('triggers newsletter saving when clicked on save button', function() {
|
||||
var mock = sinon.mock({ request: function() {} }).expects('request').once().withArgs('save');
|
||||
it('triggers newsletter saving when clicked on save button', function () {
|
||||
var mock = sinon.mock({ request: function () {} }).expects('request').once().withArgs('save');
|
||||
global.stubChannel(EditorApplication, {
|
||||
request: mock
|
||||
});
|
||||
@ -130,19 +130,19 @@ define([
|
||||
mock.verify();
|
||||
});
|
||||
|
||||
it('displays saving options when clicked on save options button', function() {
|
||||
it('displays saving options when clicked on save options button', function () {
|
||||
view.$('.mailpoet_save_show_options').click();
|
||||
expect(view.$('.mailpoet_save_options')).to.not.have.$class('mailpoet_hidden');
|
||||
});
|
||||
|
||||
it('triggers template saving when clicked on "save as template" button', function() {
|
||||
var mock = sinon.mock({ post: function() {} }).expects('post').once().returns(jQuery.Deferred());
|
||||
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 module;
|
||||
var view;
|
||||
|
||||
html2canvasMock.resolve({
|
||||
toDataURL: function() { return 'somedataurl'; }
|
||||
toDataURL: function () { return 'somedataurl'; }
|
||||
});
|
||||
|
||||
EditorApplication.getBody = sinon.stub();
|
||||
@ -152,18 +152,18 @@ define([
|
||||
post: mock
|
||||
},
|
||||
I18n: {
|
||||
t: function() { return ''; }
|
||||
t: function () { return ''; }
|
||||
},
|
||||
Notice: {
|
||||
success: function() {},
|
||||
error: function() {}
|
||||
success: function () {},
|
||||
error: function () {}
|
||||
},
|
||||
trackEvent: function() {}
|
||||
trackEvent: function () {}
|
||||
},
|
||||
'newsletter_editor/App': EditorApplication,
|
||||
html2canvas: function() {
|
||||
html2canvas: function () {
|
||||
return {
|
||||
then: function() { return html2canvasMock; }
|
||||
then: function () { return html2canvasMock; }
|
||||
};
|
||||
}
|
||||
});
|
||||
@ -177,12 +177,12 @@ define([
|
||||
mock.verify();
|
||||
});
|
||||
|
||||
it('saves newsletter when clicked on "next" button', function() {
|
||||
it('saves newsletter when clicked on "next" button', function () {
|
||||
var spy = sinon.spy();
|
||||
var view;
|
||||
var module = SaveInjector({
|
||||
'newsletter_editor/components/communication': {
|
||||
saveNewsletter: function() {
|
||||
saveNewsletter: function () {
|
||||
return jQuery.Deferred();
|
||||
}
|
||||
}
|
||||
|
@ -4,53 +4,53 @@ const Backbone = global.Backbone;
|
||||
define([
|
||||
'newsletter_editor/App',
|
||||
'newsletter_editor/components/sidebar'
|
||||
], function(EditorApplication, SidebarComponent) {
|
||||
], function (EditorApplication, SidebarComponent) {
|
||||
|
||||
describe('Sidebar', function() {
|
||||
describe('content view', function() {
|
||||
describe('Sidebar', function () {
|
||||
describe('content view', function () {
|
||||
var view;
|
||||
beforeEach(function() {
|
||||
beforeEach(function () {
|
||||
view = new (SidebarComponent.SidebarWidgetsView)({
|
||||
collection: new Backbone.Collection([])
|
||||
});
|
||||
});
|
||||
|
||||
it('renders', function() {
|
||||
it('renders', function () {
|
||||
expect(view.render).to.not.throw();
|
||||
});
|
||||
});
|
||||
|
||||
describe('layout view', function() {
|
||||
describe('layout view', function () {
|
||||
var view;
|
||||
beforeEach(function() {
|
||||
beforeEach(function () {
|
||||
view = new (SidebarComponent.SidebarLayoutWidgetsView)({
|
||||
collection: new Backbone.Collection([])
|
||||
});
|
||||
});
|
||||
|
||||
it('renders', function() {
|
||||
it('renders', function () {
|
||||
expect(view.render).to.not.throw();
|
||||
});
|
||||
});
|
||||
|
||||
describe('styles view', function() {
|
||||
describe('styles view', function () {
|
||||
var view;
|
||||
beforeEach(function() {
|
||||
beforeEach(function () {
|
||||
view = new (SidebarComponent.SidebarStylesView)({
|
||||
model: new Backbone.SuperModel({}),
|
||||
availableStyles: new Backbone.SuperModel({})
|
||||
});
|
||||
});
|
||||
|
||||
it('renders', function() {
|
||||
it('renders', function () {
|
||||
expect(view.render).to.not.throw();
|
||||
});
|
||||
|
||||
describe('once rendered', function() {
|
||||
describe('once rendered', function () {
|
||||
var model;
|
||||
var availableStyles;
|
||||
var view;
|
||||
before(function() {
|
||||
before(function () {
|
||||
model = new Backbone.SuperModel({
|
||||
text: {
|
||||
fontColor: '#000000',
|
||||
@ -96,95 +96,95 @@ define([
|
||||
view.render();
|
||||
});
|
||||
|
||||
it('changes model if text font color field changes', function() {
|
||||
it('changes model if text font color field changes', function () {
|
||||
view.$('#mailpoet_text_font_color').val('#123456').change();
|
||||
expect(model.get('text.fontColor')).to.equal('#123456');
|
||||
});
|
||||
|
||||
it('changes model if h1 font color field changes', function() {
|
||||
it('changes model if h1 font color field changes', function () {
|
||||
view.$('#mailpoet_h1_font_color').val('#123457').change();
|
||||
expect(model.get('h1.fontColor')).to.equal('#123457');
|
||||
});
|
||||
|
||||
it('changes model if h2 font color field changes', function() {
|
||||
it('changes model if h2 font color field changes', function () {
|
||||
view.$('#mailpoet_h2_font_color').val('#123458').change();
|
||||
expect(model.get('h2.fontColor')).to.equal('#123458');
|
||||
});
|
||||
|
||||
it('changes model if h3 font color field changes', function() {
|
||||
it('changes model if h3 font color field changes', function () {
|
||||
view.$('#mailpoet_h3_font_color').val('#123426').change();
|
||||
expect(model.get('h3.fontColor')).to.equal('#123426');
|
||||
});
|
||||
|
||||
it('changes model if link font color field changes', function() {
|
||||
it('changes model if link font color field changes', function () {
|
||||
view.$('#mailpoet_a_font_color').val('#323232').change();
|
||||
expect(model.get('link.fontColor')).to.equal('#323232');
|
||||
});
|
||||
|
||||
it('changes model if newsletter background color field changes', function() {
|
||||
it('changes model if newsletter background color field changes', function () {
|
||||
view.$('#mailpoet_newsletter_background_color').val('#636237').change();
|
||||
expect(model.get('wrapper.backgroundColor')).to.equal('#636237');
|
||||
});
|
||||
|
||||
it('changes model if background color field changes', function() {
|
||||
it('changes model if background color field changes', function () {
|
||||
view.$('#mailpoet_background_color').val('#878587').change();
|
||||
expect(model.get('body.backgroundColor')).to.equal('#878587');
|
||||
});
|
||||
|
||||
it('changes model if text font family field changes', function() {
|
||||
it('changes model if text font family field changes', function () {
|
||||
view.$('#mailpoet_text_font_family').val('Times New Roman').change();
|
||||
expect(model.get('text.fontFamily')).to.equal('Times New Roman');
|
||||
});
|
||||
|
||||
it('changes model if h1 font family field changes', function() {
|
||||
it('changes model if h1 font family field changes', function () {
|
||||
view.$('#mailpoet_h1_font_family').val('Comic Sans').change();
|
||||
expect(model.get('h1.fontFamily')).to.equal('Comic Sans');
|
||||
});
|
||||
|
||||
it('changes model if h2 font family field changes', function() {
|
||||
it('changes model if h2 font family field changes', function () {
|
||||
view.$('#mailpoet_h2_font_family').val('Tahoma').change();
|
||||
expect(model.get('h2.fontFamily')).to.equal('Tahoma');
|
||||
});
|
||||
|
||||
it('changes model if h3 font family field changes', function() {
|
||||
it('changes model if h3 font family field changes', function () {
|
||||
view.$('#mailpoet_h3_font_family').val('Lucida').change();
|
||||
expect(model.get('h3.fontFamily')).to.equal('Lucida');
|
||||
});
|
||||
|
||||
it('changes model if text font size field changes', function() {
|
||||
it('changes model if text font size field changes', function () {
|
||||
view.$('#mailpoet_text_font_size').val('9px').change();
|
||||
expect(model.get('text.fontSize')).to.equal('9px');
|
||||
});
|
||||
|
||||
it('changes model if h1 font size field changes', function() {
|
||||
it('changes model if h1 font size field changes', function () {
|
||||
view.$('#mailpoet_h1_font_size').val('12px').change();
|
||||
expect(model.get('h1.fontSize')).to.equal('12px');
|
||||
});
|
||||
|
||||
it('changes model if h2 font size field changes', function() {
|
||||
it('changes model if h2 font size field changes', function () {
|
||||
view.$('#mailpoet_h2_font_size').val('14px').change();
|
||||
expect(model.get('h2.fontSize')).to.equal('14px');
|
||||
});
|
||||
|
||||
it('changes model if h3 font size field changes', function() {
|
||||
it('changes model if h3 font size field changes', function () {
|
||||
view.$('#mailpoet_h3_font_size').val('16px').change();
|
||||
expect(model.get('h3.fontSize')).to.equal('16px');
|
||||
});
|
||||
|
||||
it('changes model if link underline field changes', function() {
|
||||
it('changes model if link underline field changes', function () {
|
||||
view.$('#mailpoet_a_font_underline').prop('checked', true).change();
|
||||
expect(model.get('link.textDecoration')).to.equal('underline');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('preview view', function() {
|
||||
describe('preview view', function () {
|
||||
var view;
|
||||
beforeEach(function() {
|
||||
beforeEach(function () {
|
||||
view = new (SidebarComponent.SidebarPreviewView)();
|
||||
});
|
||||
|
||||
it('renders', function() {
|
||||
it('renders', function () {
|
||||
expect(view.render).to.not.throw();
|
||||
});
|
||||
});
|
||||
|
@ -4,11 +4,11 @@ const sinon = global.sinon;
|
||||
define([
|
||||
'newsletter_editor/App',
|
||||
'newsletter_editor/components/styles'
|
||||
], function(App, StylesComponent) {
|
||||
], function (App, StylesComponent) {
|
||||
var EditorApplication = App;
|
||||
|
||||
describe('Styles', function () {
|
||||
it('loads and stores globally available styles', function() {
|
||||
it('loads and stores globally available styles', function () {
|
||||
var model;
|
||||
StylesComponent.setGlobalStyles({
|
||||
testStyle: 'testValue'
|
||||
@ -17,15 +17,15 @@ define([
|
||||
expect(model.get('testStyle')).to.equal('testValue');
|
||||
});
|
||||
|
||||
describe('model', function() {
|
||||
describe('model', function () {
|
||||
var model;
|
||||
beforeEach(function() {
|
||||
beforeEach(function () {
|
||||
model = new (StylesComponent.StylesModel)();
|
||||
});
|
||||
|
||||
it('triggers autoSave when changed', function() {
|
||||
var mock = sinon.mock({ trigger: function() {}}).expects('trigger').once().withExactArgs('autoSave');
|
||||
EditorApplication.getChannel = function() {
|
||||
it('triggers autoSave when changed', function () {
|
||||
var mock = sinon.mock({ trigger: function () {}}).expects('trigger').once().withExactArgs('autoSave');
|
||||
EditorApplication.getChannel = function () {
|
||||
return {
|
||||
trigger: mock
|
||||
};
|
||||
@ -35,15 +35,15 @@ define([
|
||||
});
|
||||
});
|
||||
|
||||
describe('view', function() {
|
||||
describe('view', function () {
|
||||
var model;
|
||||
var view;
|
||||
beforeEach(function() {
|
||||
beforeEach(function () {
|
||||
model = new (StylesComponent.StylesModel)();
|
||||
view = new (StylesComponent.StylesView)({ model: model });
|
||||
});
|
||||
|
||||
it('renders', function() {
|
||||
it('renders', function () {
|
||||
expect(view.render).to.not.throw();
|
||||
});
|
||||
});
|
||||
|
Reference in New Issue
Block a user