Fix indent rule in tests

[MAILPOET-1029]
This commit is contained in:
Pavel Dohnal
2017-09-07 16:05:45 +01:00
parent 122af1c943
commit 195ccb5eed
19 changed files with 228 additions and 229 deletions

View File

@@ -11,7 +11,6 @@
"import/no-amd": 0, "import/no-amd": 0,
"no-undef": 0, "no-undef": 0,
"one-var": 0, "one-var": 0,
"indent": 0,
"no-whitespace-before-property": 0, "no-whitespace-before-property": 0,
"global-require": 0, "global-require": 0,
"keyword-spacing": 0, "keyword-spacing": 0,

View File

@@ -1,15 +1,15 @@
define([ define([
'newsletter_editor/App', 'newsletter_editor/App',
'newsletter_editor/blocks/automatedLatestContent', 'newsletter_editor/blocks/automatedLatestContent',
'newsletter_editor/blocks/container', 'newsletter_editor/blocks/container',
'amd-inject-loader!newsletter_editor/blocks/automatedLatestContent', 'amd-inject-loader!newsletter_editor/blocks/automatedLatestContent',
'newsletter_editor/components/communication' 'newsletter_editor/components/communication'
], function( ], function(
App, App,
AutomatedLatestContentBlock, AutomatedLatestContentBlock,
ContainerBlock, ContainerBlock,
AutomatedLatestContentInjector, AutomatedLatestContentInjector,
Communication Communication
) { ) {
var EditorApplication = App; var EditorApplication = App;
var CommunicationComponent = Communication; var CommunicationComponent = Communication;

View File

@@ -1,7 +1,7 @@
define([ define([
'newsletter_editor/App', 'newsletter_editor/App',
'newsletter_editor/blocks/button' 'newsletter_editor/blocks/button'
], function(App, ButtonBlock) { ], function(App, ButtonBlock) {
var EditorApplication = App; var EditorApplication = App;
describe('Button', function () { describe('Button', function () {

View File

@@ -1,7 +1,7 @@
define([ define([
'newsletter_editor/App', 'newsletter_editor/App',
'newsletter_editor/blocks/container' 'newsletter_editor/blocks/container'
], function(App, ContainerBlock) { ], function(App, ContainerBlock) {
var EditorApplication = App; var EditorApplication = App;
describe('Container', function () { describe('Container', function () {
@@ -193,13 +193,13 @@ define([
}); });
describe('once rendered', function () { describe('once rendered', function () {
var model, view; var model, view;
beforeEach(function() { beforeEach(function() {
global.stubChannel(EditorApplication); global.stubChannel(EditorApplication);
global.stubAvailableStyles(EditorApplication); global.stubAvailableStyles(EditorApplication);
model = new (ContainerBlock.ContainerBlockModel)(); model = new (ContainerBlock.ContainerBlockModel)();
view = new (ContainerBlock.ContainerBlockSettingsView)({model: model}); view = new (ContainerBlock.ContainerBlockSettingsView)({model: model});
}); });
it('updates the model when background color changes', function () { it('updates the model when background color changes', function () {
view.$('.mailpoet_field_container_background_color').val('#123456').change(); view.$('.mailpoet_field_container_background_color').val('#123456').change();

View File

@@ -1,7 +1,7 @@
define([ define([
'newsletter_editor/App', 'newsletter_editor/App',
'newsletter_editor/blocks/divider' 'newsletter_editor/blocks/divider'
], function(App, DividerBlock) { ], function(App, DividerBlock) {
var EditorApplication = App; var EditorApplication = App;
describe('Divider', function () { describe('Divider', function () {

View File

@@ -1,7 +1,7 @@
define([ define([
'newsletter_editor/App', 'newsletter_editor/App',
'newsletter_editor/blocks/footer' 'newsletter_editor/blocks/footer'
], function(App, FooterBlock) { ], function(App, FooterBlock) {
var EditorApplication = App; var EditorApplication = App;
describe('Footer', function () { describe('Footer', function () {
@@ -145,18 +145,18 @@ define([
}); });
describe('once rendered', function () { describe('once rendered', function () {
var model, view; var model, view;
beforeEach(function() { beforeEach(function() {
global.stubChannel(EditorApplication); global.stubChannel(EditorApplication);
global.stubAvailableStyles(EditorApplication, { global.stubAvailableStyles(EditorApplication, {
fonts: ['Arial', 'Tahoma'], fonts: ['Arial', 'Tahoma'],
textSizes: ['16px', '20px'] textSizes: ['16px', '20px']
});
model = new (FooterBlock.FooterBlockModel)({});
view = new (FooterBlock.FooterBlockSettingsView)({model: model});
view.render();
}); });
model = new (FooterBlock.FooterBlockModel)({});
view = new (FooterBlock.FooterBlockSettingsView)({model: model});
view.render();
});
it('updates the model when text font color changes', function () { it('updates the model when text font color changes', function () {
view.$('.mailpoet_field_footer_text_color').val('#123456').change(); view.$('.mailpoet_field_footer_text_color').val('#123456').change();

View File

@@ -1,7 +1,7 @@
define([ define([
'newsletter_editor/App', 'newsletter_editor/App',
'newsletter_editor/blocks/header' 'newsletter_editor/blocks/header'
], function(App, HeaderBlock) { ], function(App, HeaderBlock) {
var EditorApplication = App; var EditorApplication = App;
describe('Header', function () { describe('Header', function () {
@@ -145,18 +145,18 @@ define([
}); });
describe('once rendered', function () { describe('once rendered', function () {
var model, view; var model, view;
beforeEach(function() { beforeEach(function() {
global.stubChannel(EditorApplication); global.stubChannel(EditorApplication);
global.stubAvailableStyles(EditorApplication, { global.stubAvailableStyles(EditorApplication, {
fonts: ['Arial', 'Tahoma'], fonts: ['Arial', 'Tahoma'],
textSizes: ['16px', '20px'] textSizes: ['16px', '20px']
});
model = new (HeaderBlock.HeaderBlockModel)({});
view = new (HeaderBlock.HeaderBlockSettingsView)({model: model});
view.render();
}); });
model = new (HeaderBlock.HeaderBlockModel)({});
view = new (HeaderBlock.HeaderBlockSettingsView)({model: model});
view.render();
});
it('updates the model when text font color changes', function () { it('updates the model when text font color changes', function () {
view.$('.mailpoet_field_header_text_color').val('#123456').change(); view.$('.mailpoet_field_header_text_color').val('#123456').change();

View File

@@ -1,7 +1,7 @@
define([ define([
'newsletter_editor/App', 'newsletter_editor/App',
'newsletter_editor/blocks/image' 'newsletter_editor/blocks/image'
], function(App, ImageBlock) { ], function(App, ImageBlock) {
var EditorApplication = App; var EditorApplication = App;
describe('Image', function () { describe('Image', function () {

View File

@@ -1,9 +1,9 @@
define([ define([
'newsletter_editor/App', 'newsletter_editor/App',
'newsletter_editor/components/communication', 'newsletter_editor/components/communication',
'newsletter_editor/blocks/posts', 'newsletter_editor/blocks/posts',
'newsletter_editor/blocks/container' 'newsletter_editor/blocks/container'
], function(App, Communication, PostsBlock, ContainerBlock) { ], function(App, Communication, PostsBlock, ContainerBlock) {
var EditorApplication = App; var EditorApplication = App;
var CommunicationComponent = Communication; var CommunicationComponent = Communication;

View File

@@ -1,8 +1,8 @@
define([ define([
'newsletter_editor/App', 'newsletter_editor/App',
'newsletter_editor/blocks/social', 'newsletter_editor/blocks/social',
'backbone' 'backbone'
], function(EditorApplication, SocialBlock, Backbone) { ], function(EditorApplication, SocialBlock, Backbone) {
describe('Social', function () { describe('Social', function () {
describe('block model', function () { describe('block model', function () {

View File

@@ -1,7 +1,7 @@
define([ define([
'newsletter_editor/App', 'newsletter_editor/App',
'newsletter_editor/blocks/spacer' 'newsletter_editor/blocks/spacer'
], function(App, SpacerBlock) { ], function(App, SpacerBlock) {
var EditorApplication = App; var EditorApplication = App;
describe('Spacer', function () { describe('Spacer', function () {
@@ -134,11 +134,11 @@ define([
describe('once rendered', function () { describe('once rendered', function () {
var view, model; var view, model;
beforeEach(function() { beforeEach(function() {
global.stubChannel(EditorApplication); global.stubChannel(EditorApplication);
global.stubConfig(EditorApplication); global.stubConfig(EditorApplication);
model = new (SpacerBlock.SpacerBlockModel)(); model = new (SpacerBlock.SpacerBlockModel)();
view = new (SpacerBlock.SpacerBlockSettingsView)({model: model}); view = new (SpacerBlock.SpacerBlockSettingsView)({model: model});
view.render(); view.render();
}); });
it('updates the model when background color changes', function () { it('updates the model when background color changes', function () {

View File

@@ -1,7 +1,7 @@
define([ define([
'newsletter_editor/App', 'newsletter_editor/App',
'newsletter_editor/blocks/text' 'newsletter_editor/blocks/text'
], function(EditorApplication, TextBlock) { ], function(EditorApplication, TextBlock) {
describe('Text', function () { describe('Text', function () {
describe('model', function () { describe('model', function () {

View File

@@ -1,27 +1,27 @@
define([ define([
'newsletter_editor/App', 'newsletter_editor/App',
'newsletter_editor/components/communication', 'newsletter_editor/components/communication',
'amd-inject-loader!newsletter_editor/components/communication' 'amd-inject-loader!newsletter_editor/components/communication'
], function(EditorApplication, Communication, CommunicationInjector) { ], function(EditorApplication, Communication, CommunicationInjector) {
describe('getPostTypes', function() { describe('getPostTypes', function() {
it('fetches post types from the server', function() { it('fetches post types from the server', function() {
var module = CommunicationInjector({ var module = CommunicationInjector({
mailpoet: { mailpoet: {
Ajax: { Ajax: {
post: function() { post: function() {
var deferred = jQuery.Deferred(); var deferred = jQuery.Deferred();
deferred.resolve({ deferred.resolve({
data: { data: {
post: 'val1', post: 'val1',
page: 'val2' page: 'val2'
} }
}); });
return deferred; return deferred;
}
} }
} }
}); }
});
module.getPostTypes().done(function(types) { module.getPostTypes().done(function(types) {
expect(types).to.eql(['val1', 'val2']); expect(types).to.eql(['val1', 'val2']);
}); });
@@ -29,14 +29,14 @@ define([
it('caches results', function() { it('caches results', function() {
var deferred = jQuery.Deferred(), var deferred = jQuery.Deferred(),
mock = sinon.mock({ post: function() {} }).expects('post').once().returns(deferred), mock = sinon.mock({ post: function() {} }).expects('post').once().returns(deferred),
module = CommunicationInjector({ module = CommunicationInjector({
mailpoet: { mailpoet: {
Ajax: { Ajax: {
post: mock post: mock
}
} }
}); }
});
deferred.resolve({ deferred.resolve({
post: 'val1', post: 'val1',
page: 'val2' page: 'val2'
@@ -51,15 +51,15 @@ define([
describe('getTaxonomies', function() { describe('getTaxonomies', function() {
it('sends post type to endpoint', function() { it('sends post type to endpoint', function() {
var spy, var spy,
post = function(params) { post = function(params) {
var deferred = jQuery.Deferred(); var deferred = jQuery.Deferred();
deferred.resolve({ deferred.resolve({
category: 'val1', category: 'val1',
post_tag: 'val2' post_tag: 'val2'
}); });
return deferred; return deferred;
}, },
module; module;
spy = sinon.spy(post); spy = sinon.spy(post);
module = CommunicationInjector({ module = CommunicationInjector({
mailpoet: { mailpoet: {
@@ -75,20 +75,20 @@ define([
it('fetches taxonomies from the server', function() { it('fetches taxonomies from the server', function() {
var module = CommunicationInjector({ var module = CommunicationInjector({
mailpoet: { mailpoet: {
Ajax: { Ajax: {
post: function() { post: function() {
var deferred = jQuery.Deferred(); var deferred = jQuery.Deferred();
deferred.resolve({ deferred.resolve({
data: { data: {
category: 'val1' category: 'val1'
} }
}); });
return deferred; return deferred;
}
} }
} }
}); }
});
module.getTaxonomies('page').done(function(types) { module.getTaxonomies('page').done(function(types) {
expect(types).to.eql({ category: 'val1' }); expect(types).to.eql({ category: 'val1' });
}); });
@@ -96,14 +96,14 @@ define([
it('caches results', function() { it('caches results', function() {
var deferred = jQuery.Deferred(), var deferred = jQuery.Deferred(),
mock = sinon.mock({ post: function() {} }).expects('post').once().returns(deferred), mock = sinon.mock({ post: function() {} }).expects('post').once().returns(deferred),
module = CommunicationInjector({ module = CommunicationInjector({
mailpoet: { mailpoet: {
Ajax: { Ajax: {
post: mock post: mock
}
} }
}); }
});
deferred.resolve({ category: 'val1' }); deferred.resolve({ category: 'val1' });
module.getTaxonomies('page'); module.getTaxonomies('page');
module.getTaxonomies('page'); module.getTaxonomies('page');
@@ -138,21 +138,21 @@ define([
it('fetches terms from the server', function() { it('fetches terms from the server', function() {
var module = CommunicationInjector({ var module = CommunicationInjector({
mailpoet: { mailpoet: {
Ajax: { Ajax: {
post: function() { post: function() {
var deferred = jQuery.Deferred(); var deferred = jQuery.Deferred();
deferred.resolve({ deferred.resolve({
data: { data: {
term1: 'term1val1', term1: 'term1val1',
term2: 'term2val2' term2: 'term2val2'
} }
}); });
return deferred; return deferred;
}
} }
} }
}); }
});
module.getTerms({ taxonomies: ['category'] }).done(function(types) { module.getTerms({ taxonomies: ['category'] }).done(function(types) {
expect(types).to.eql({ term1: 'term1val1', term2: 'term2val2' }); expect(types).to.eql({ term1: 'term1val1', term2: 'term2val2' });
}); });
@@ -160,14 +160,14 @@ define([
it('caches results', function() { it('caches results', function() {
var deferred = jQuery.Deferred(), var deferred = jQuery.Deferred(),
mock = sinon.mock({ post: function() {} }).expects('post').once().returns(deferred), mock = sinon.mock({ post: function() {} }).expects('post').once().returns(deferred),
module = CommunicationInjector({ module = CommunicationInjector({
mailpoet: { mailpoet: {
Ajax: { Ajax: {
post: mock post: mock
}
} }
}); }
});
deferred.resolve({ term1: 'term1val1', term2: 'term2val2' }); deferred.resolve({ term1: 'term1val1', term2: 'term2val2' });
module.getTerms({ taxonomies: ['category'] }); module.getTerms({ taxonomies: ['category'] });
module.getTerms({ taxonomies: ['category'] }); module.getTerms({ taxonomies: ['category'] });
@@ -179,12 +179,12 @@ define([
describe('getPosts', function() { describe('getPosts', function() {
it('sends options to endpoint', function() { it('sends options to endpoint', function() {
var spy, var spy,
post = function(params) { post = function(params) {
var deferred = jQuery.Deferred(); var deferred = jQuery.Deferred();
deferred.resolve({}); deferred.resolve({});
return deferred; return deferred;
}, },
module; module;
spy = sinon.spy(post); spy = sinon.spy(post);
module = CommunicationInjector({ module = CommunicationInjector({
mailpoet: { mailpoet: {
@@ -206,21 +206,21 @@ define([
it('fetches posts from the server', function() { it('fetches posts from the server', function() {
var module = CommunicationInjector({ var module = CommunicationInjector({
mailpoet: { mailpoet: {
Ajax: { Ajax: {
post: function() { post: function() {
var deferred = jQuery.Deferred(); var deferred = jQuery.Deferred();
deferred.resolve({ deferred.resolve({
data: [ data: [
{post_title: 'title 1'}, {post_title: 'title 1'},
{post_title: 'post title 2'} {post_title: 'post title 2'}
] ]
}); });
return deferred; return deferred;
}
} }
} }
}); }
});
module.getPosts().done(function(posts) { module.getPosts().done(function(posts) {
expect(posts).to.eql([{post_title: 'title 1'}, {post_title: 'post title 2'}]); expect(posts).to.eql([{post_title: 'title 1'}, {post_title: 'post title 2'}]);
}); });
@@ -228,14 +228,14 @@ define([
it('caches results', function() { it('caches results', function() {
var deferred = jQuery.Deferred(), var deferred = jQuery.Deferred(),
mock = sinon.mock({ post: function() {} }).expects('post').once().returns(deferred), mock = sinon.mock({ post: function() {} }).expects('post').once().returns(deferred),
module = CommunicationInjector({ module = CommunicationInjector({
mailpoet: { mailpoet: {
Ajax: { Ajax: {
post: mock post: mock
}
} }
}); }
});
deferred.resolve({ deferred.resolve({
type: 'posts', type: 'posts',
search: 'some search term' search: 'some search term'
@@ -250,12 +250,12 @@ define([
describe('getTransformedPosts', function() { describe('getTransformedPosts', function() {
it('sends options to endpoint', function() { it('sends options to endpoint', function() {
var spy, var spy,
post = function(params) { post = function(params) {
var deferred = jQuery.Deferred(); var deferred = jQuery.Deferred();
deferred.resolve({}); deferred.resolve({});
return deferred; return deferred;
}, },
module; module;
spy = sinon.spy(post); spy = sinon.spy(post);
module = CommunicationInjector({ module = CommunicationInjector({
mailpoet: { mailpoet: {
@@ -277,21 +277,21 @@ define([
it('fetches transformed posts from the server', function() { it('fetches transformed posts from the server', function() {
var module = CommunicationInjector({ var module = CommunicationInjector({
mailpoet: { mailpoet: {
Ajax: { Ajax: {
post: function() { post: function() {
var deferred = jQuery.Deferred(); var deferred = jQuery.Deferred();
deferred.resolve({ deferred.resolve({
data: [ data: [
{type: 'text', text: 'something'}, {type: 'text', text: 'something'},
{type: 'text', text: 'something else'} {type: 'text', text: 'something else'}
] ]
}); });
return deferred; return deferred;
}
} }
} }
}); }
});
module.getTransformedPosts().done(function(posts) { module.getTransformedPosts().done(function(posts) {
expect(posts).to.eql([{type: 'text', text: 'something'}, {type: 'text', text: 'something else'}]); expect(posts).to.eql([{type: 'text', text: 'something'}, {type: 'text', text: 'something else'}]);
}); });
@@ -299,14 +299,14 @@ define([
it('caches results', function() { it('caches results', function() {
var deferred = jQuery.Deferred(), var deferred = jQuery.Deferred(),
mock = sinon.mock({ post: function() {} }).expects('post').once().returns(deferred), mock = sinon.mock({ post: function() {} }).expects('post').once().returns(deferred),
module = CommunicationInjector({ module = CommunicationInjector({
mailpoet: { mailpoet: {
Ajax: { Ajax: {
post: mock post: mock
}
} }
}); }
});
deferred.resolve({ deferred.resolve({
type: 'posts', type: 'posts',
posts: [1, 3] posts: [1, 3]

View File

@@ -1,7 +1,7 @@
define([ define([
'newsletter_editor/App', 'newsletter_editor/App',
'newsletter_editor/components/config' 'newsletter_editor/components/config'
], function(EditorApplication, ConfigComponent) { ], function(EditorApplication, ConfigComponent) {
describe('Config', function () { describe('Config', function () {
it('loads and stores configuration', function() { it('loads and stores configuration', function() {

View File

@@ -1,7 +1,7 @@
define([ define([
'newsletter_editor/App', 'newsletter_editor/App',
'newsletter_editor/components/content' 'newsletter_editor/components/content'
], function(App, ContentComponent) { ], function(App, ContentComponent) {
var EditorApplication = App; var EditorApplication = App;
describe('Content', function() { describe('Content', function() {
@@ -74,12 +74,12 @@ define([
describe('transformation to json', function() { describe('transformation to json', function() {
it('includes content, globalStyles and initial newsletter fields', function() { it('includes content, globalStyles and initial newsletter fields', function() {
var dataField = { var dataField = {
containerModelField: 'containerModelValue' containerModelField: 'containerModelValue'
}, stylesField = { }, stylesField = {
globalStylesField: 'globalStylesValue' globalStylesField: 'globalStylesValue'
}, newsletterFields = { }, newsletterFields = {
subject: 'test newsletter subject' subject: 'test newsletter subject'
}; };
EditorApplication._contentContainer = { EditorApplication._contentContainer = {
toJSON: function() { toJSON: function() {
return dataField; return dataField;

View File

@@ -1,7 +1,7 @@
define([ define([
'newsletter_editor/App', 'newsletter_editor/App',
'newsletter_editor/components/heading' 'newsletter_editor/components/heading'
], function(EditorApplication, HeadingComponent) { ], function(EditorApplication, HeadingComponent) {
describe('Heading', function() { describe('Heading', function() {
describe('view', function() { describe('view', function() {

View File

@@ -1,9 +1,9 @@
define([ define([
'newsletter_editor/App', 'newsletter_editor/App',
'newsletter_editor/components/save', 'newsletter_editor/components/save',
'amd-inject-loader!newsletter_editor/components/save', 'amd-inject-loader!newsletter_editor/components/save',
'jquery' 'jquery'
], function(App, SaveComponent, SaveInjector, jQuery) { ], function(App, SaveComponent, SaveInjector, jQuery) {
var EditorApplication = App; var EditorApplication = App;
describe('Save', function() { describe('Save', function() {
@@ -171,13 +171,13 @@ define([
it('saves newsletter when clicked on "next" button', function() { it('saves newsletter when clicked on "next" button', function() {
var spy = sinon.spy(), var spy = sinon.spy(),
module = SaveInjector({ module = SaveInjector({
'newsletter_editor/components/communication': { 'newsletter_editor/components/communication': {
saveNewsletter: function() { saveNewsletter: function() {
return jQuery.Deferred(); return jQuery.Deferred();
}
} }
}); }
});
global.stubChannel(EditorApplication, { global.stubChannel(EditorApplication, {
trigger: spy trigger: spy
}); });

View File

@@ -1,7 +1,7 @@
define([ define([
'newsletter_editor/App', 'newsletter_editor/App',
'newsletter_editor/components/sidebar' 'newsletter_editor/components/sidebar'
], function(EditorApplication, SidebarComponent) { ], function(EditorApplication, SidebarComponent) {
describe('Sidebar', function() { describe('Sidebar', function() {
describe('content view', function() { describe('content view', function() {

View File

@@ -1,7 +1,7 @@
define([ define([
'newsletter_editor/App', 'newsletter_editor/App',
'newsletter_editor/components/styles' 'newsletter_editor/components/styles'
], function(App, StylesComponent) { ], function(App, StylesComponent) {
var EditorApplication = App; var EditorApplication = App;
describe('Styles', function () { describe('Styles', function () {