Fix no-param-reassign in tests
[MAILPOET-1033]
This commit is contained in:
@ -37,7 +37,6 @@
|
|||||||
"vars-on-top": 0,
|
"vars-on-top": 0,
|
||||||
"space-before-blocks": 0,
|
"space-before-blocks": 0,
|
||||||
"object-curly-spacing": 0,
|
"object-curly-spacing": 0,
|
||||||
"no-param-reassign": 0,
|
|
||||||
"one-var-declaration-per-line": 0,
|
"one-var-declaration-per-line": 0,
|
||||||
"func-names": 0,
|
"func-names": 0,
|
||||||
"space-before-function-paren": 0
|
"space-before-function-paren": 0
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
var fs = require('fs');
|
var fs = require('fs');
|
||||||
module.exports = {
|
module.exports = {
|
||||||
loadFileToContainer: function (path, window, containerTagName, options) {
|
loadFileToContainer: function (path, window, containerTagName, opts) {
|
||||||
var contents = fs.readFileSync(path),
|
var contents = fs.readFileSync(path),
|
||||||
container = window.document.createElement(containerTagName);
|
container = window.document.createElement(containerTagName);
|
||||||
options = options || {};
|
var options = opts || {};
|
||||||
container.innerHTML = contents;
|
container.innerHTML = contents;
|
||||||
|
|
||||||
if (options.type) {
|
if (options.type) {
|
||||||
@ -17,9 +17,9 @@ module.exports = {
|
|||||||
loadScript: function (scriptPath, window, options) {
|
loadScript: function (scriptPath, window, options) {
|
||||||
this.loadFileToContainer(scriptPath, window, 'script', options);
|
this.loadFileToContainer(scriptPath, window, 'script', options);
|
||||||
},
|
},
|
||||||
loadTemplate: function (path, window, options) {
|
loadTemplate: function (path, window, opts) {
|
||||||
var w = window || global.window;
|
var w = window || global.window;
|
||||||
options = options || {};
|
var options = opts || {};
|
||||||
options.type = "text/x-handlebars-template";
|
options.type = "text/x-handlebars-template";
|
||||||
|
|
||||||
this.loadScript("views/newsletter/templates/" + path, w, options);
|
this.loadScript("views/newsletter/templates/" + path, w, options);
|
||||||
|
@ -55,20 +55,21 @@ jQuery.fn.stick_in_parent = function() { return this; };
|
|||||||
// Add global stubs for convenience
|
// Add global stubs for convenience
|
||||||
// TODO: Extract those to a separate file
|
// TODO: Extract those to a separate file
|
||||||
global.stubChannel = function (EditorApplication, returnObject) {
|
global.stubChannel = function (EditorApplication, returnObject) {
|
||||||
EditorApplication.getChannel = sinon.stub().returns(_.defaults(returnObject || {}, {
|
var App = EditorApplication;
|
||||||
|
App.getChannel = sinon.stub().returns(_.defaults(returnObject || {}, {
|
||||||
trigger: function () {
|
trigger: function () {
|
||||||
},
|
},
|
||||||
on: function () {
|
on: function () {
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
};
|
};
|
||||||
global.stubConfig = function (EditorApplication, config) {
|
global.stubConfig = function (EditorApplication, opts) {
|
||||||
config = config || {};
|
var App = EditorApplication;
|
||||||
EditorApplication.getConfig = sinon.stub().returns(new Backbone.SuperModel(config));
|
App.getConfig = sinon.stub().returns(new Backbone.SuperModel(opts || {}));
|
||||||
};
|
};
|
||||||
global.stubAvailableStyles = function (EditorApplication, styles) {
|
global.stubAvailableStyles = function (EditorApplication, styles) {
|
||||||
styles = styles || {};
|
var App = EditorApplication;
|
||||||
EditorApplication.getAvailableStyles = sinon.stub().returns(new Backbone.SuperModel(styles));
|
App.getAvailableStyles = sinon.stub().returns(new Backbone.SuperModel(styles || {}));
|
||||||
};
|
};
|
||||||
|
|
||||||
global.stubImage = function(defaultWidth, defaultHeight) {
|
global.stubImage = function(defaultWidth, defaultHeight) {
|
||||||
|
@ -5,12 +5,14 @@ define([
|
|||||||
'amd-inject-loader!newsletter_editor/blocks/automatedLatestContent',
|
'amd-inject-loader!newsletter_editor/blocks/automatedLatestContent',
|
||||||
'newsletter_editor/components/communication'
|
'newsletter_editor/components/communication'
|
||||||
], function(
|
], function(
|
||||||
EditorApplication,
|
App,
|
||||||
AutomatedLatestContentBlock,
|
AutomatedLatestContentBlock,
|
||||||
ContainerBlock,
|
ContainerBlock,
|
||||||
AutomatedLatestContentInjector,
|
AutomatedLatestContentInjector,
|
||||||
CommunicationComponent
|
Communication
|
||||||
) {
|
) {
|
||||||
|
var EditorApplication = App;
|
||||||
|
var CommunicationComponent = Communication;
|
||||||
|
|
||||||
describe('Automated Latest Content Supervisor', function() {
|
describe('Automated Latest Content Supervisor', function() {
|
||||||
var model;
|
var model;
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
define([
|
define([
|
||||||
'newsletter_editor/App',
|
'newsletter_editor/App',
|
||||||
'newsletter_editor/blocks/button'
|
'newsletter_editor/blocks/button'
|
||||||
], function(EditorApplication, ButtonBlock) {
|
], function(App, ButtonBlock) {
|
||||||
|
var EditorApplication = App;
|
||||||
|
|
||||||
describe("Button", function () {
|
describe("Button", function () {
|
||||||
describe("model", function () {
|
describe("model", function () {
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
define([
|
define([
|
||||||
'newsletter_editor/App',
|
'newsletter_editor/App',
|
||||||
'newsletter_editor/blocks/container'
|
'newsletter_editor/blocks/container'
|
||||||
], function(EditorApplication, ContainerBlock) {
|
], function(App, ContainerBlock) {
|
||||||
|
var EditorApplication = App;
|
||||||
|
|
||||||
describe('Container', function () {
|
describe('Container', function () {
|
||||||
var ModelClass = ContainerBlock.ContainerBlockModel;
|
var ModelClass = ContainerBlock.ContainerBlockModel;
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
define([
|
define([
|
||||||
'newsletter_editor/App',
|
'newsletter_editor/App',
|
||||||
'newsletter_editor/blocks/divider'
|
'newsletter_editor/blocks/divider'
|
||||||
], function(EditorApplication, DividerBlock) {
|
], function(App, DividerBlock) {
|
||||||
|
var EditorApplication = App;
|
||||||
|
|
||||||
describe("Divider", function () {
|
describe("Divider", function () {
|
||||||
describe("model", function () {
|
describe("model", function () {
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
define([
|
define([
|
||||||
'newsletter_editor/App',
|
'newsletter_editor/App',
|
||||||
'newsletter_editor/blocks/footer'
|
'newsletter_editor/blocks/footer'
|
||||||
], function(EditorApplication, FooterBlock) {
|
], function(App, FooterBlock) {
|
||||||
|
var EditorApplication = App;
|
||||||
|
|
||||||
describe('Footer', function () {
|
describe('Footer', function () {
|
||||||
describe('model', function () {
|
describe('model', function () {
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
define([
|
define([
|
||||||
'newsletter_editor/App',
|
'newsletter_editor/App',
|
||||||
'newsletter_editor/blocks/header'
|
'newsletter_editor/blocks/header'
|
||||||
], function(EditorApplication, HeaderBlock) {
|
], function(App, HeaderBlock) {
|
||||||
|
var EditorApplication = App;
|
||||||
|
|
||||||
describe('Header', function () {
|
describe('Header', function () {
|
||||||
describe('model', function () {
|
describe('model', function () {
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
define([
|
define([
|
||||||
'newsletter_editor/App',
|
'newsletter_editor/App',
|
||||||
'newsletter_editor/blocks/image'
|
'newsletter_editor/blocks/image'
|
||||||
], function(EditorApplication, ImageBlock) {
|
], function(App, ImageBlock) {
|
||||||
|
var EditorApplication = App;
|
||||||
|
|
||||||
describe('Image', function () {
|
describe('Image', function () {
|
||||||
describe('model', function () {
|
describe('model', function () {
|
||||||
|
@ -3,7 +3,9 @@ define([
|
|||||||
'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(EditorApplication, CommunicationComponent, PostsBlock, ContainerBlock) {
|
], function(App, Communication, PostsBlock, ContainerBlock) {
|
||||||
|
var EditorApplication = App;
|
||||||
|
var CommunicationComponent = Communication;
|
||||||
|
|
||||||
describe('Posts', function () {
|
describe('Posts', function () {
|
||||||
Backbone.Radio = {
|
Backbone.Radio = {
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
define([
|
define([
|
||||||
'newsletter_editor/App',
|
'newsletter_editor/App',
|
||||||
'newsletter_editor/blocks/spacer'
|
'newsletter_editor/blocks/spacer'
|
||||||
], function(EditorApplication, SpacerBlock) {
|
], function(App, SpacerBlock) {
|
||||||
|
var EditorApplication = App;
|
||||||
|
|
||||||
describe('Spacer', function () {
|
describe('Spacer', function () {
|
||||||
describe('model', function () {
|
describe('model', function () {
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
define([
|
define([
|
||||||
'newsletter_editor/App',
|
'newsletter_editor/App',
|
||||||
'newsletter_editor/components/content'
|
'newsletter_editor/components/content'
|
||||||
], function(EditorApplication, ContentComponent) {
|
], function(App, ContentComponent) {
|
||||||
|
var EditorApplication = App;
|
||||||
|
|
||||||
describe('Content', function() {
|
describe('Content', function() {
|
||||||
describe('newsletter model', function() {
|
describe('newsletter model', function() {
|
||||||
|
@ -3,7 +3,8 @@ define([
|
|||||||
'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(EditorApplication, SaveComponent, SaveInjector, jQuery) {
|
], function(App, SaveComponent, SaveInjector, jQuery) {
|
||||||
|
var EditorApplication = App;
|
||||||
|
|
||||||
describe('Save', function() {
|
describe('Save', function() {
|
||||||
describe('save method', function() {
|
describe('save method', function() {
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
define([
|
define([
|
||||||
'newsletter_editor/App',
|
'newsletter_editor/App',
|
||||||
'newsletter_editor/components/styles'
|
'newsletter_editor/components/styles'
|
||||||
], function(EditorApplication, StylesComponent) {
|
], function(App, StylesComponent) {
|
||||||
|
var EditorApplication = App;
|
||||||
|
|
||||||
describe('Styles', function () {
|
describe('Styles', function () {
|
||||||
it('loads and stores globally available styles', function() {
|
it('loads and stores globally available styles', function() {
|
||||||
|
Reference in New Issue
Block a user