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