Fix order of definitions, remove unnecesary vars

[MAILPOET-1829]
This commit is contained in:
Jan Jakeš
2019-02-20 13:15:46 +01:00
committed by M. Shull
parent e95e7d3b4c
commit 61ab593dcb
20 changed files with 63 additions and 69 deletions

View File

@ -1,3 +1,7 @@
import MailPoet from 'mailpoet';
import jQuery from 'jquery';
import _ from 'underscore';
function requestFailed(errorMessage, xhr) {
if (xhr.responseJSON) {
return xhr.responseJSON;
@ -11,12 +15,6 @@ function requestFailed(errorMessage, xhr) {
};
}
import mp from 'mailpoet';
import jQuery from 'jquery';
import _ from 'underscore';
var MailPoet = mp;
MailPoet.Ajax = {
version: 0.5,
options: {},

View File

@ -7,6 +7,8 @@
* even if it has been disabled.
*
*/
import MailPoet from 'mailpoet';
import _ from 'underscore';
/**
* This is to cache events which are triggered before the mixpanel
@ -24,8 +26,7 @@ function track(name, data) {
window.mixpanel.track(name, data);
}
function exportMixpanel(mp) {
var MailPoet = mp;
function exportMixpanel() {
MailPoet.forceTrackEvent = track;
if (window.mailpoet_analytics_enabled) {
@ -51,14 +52,9 @@ function cacheEvent(forced, name, data) {
});
}
import mp from 'mailpoet';
import _ from 'underscore';
var MailPoet = mp;
function initializeMixpanelWhenLoaded() {
if (typeof window.mixpanel === 'object') {
exportMixpanel(MailPoet);
exportMixpanel();
trackCachedEvents();
} else {
setTimeout(initializeMixpanelWhenLoaded, 100);

View File

@ -1,8 +1,3 @@
const expect = global.expect;
const sinon = global.sinon;
const Backbone = global.Backbone;
const jQuery = global.jQuery;
import App from 'newsletter_editor/App';
import AutomatedLatestContentBlock from 'newsletter_editor/blocks/automatedLatestContent';
import ContainerBlock from 'newsletter_editor/blocks/container';
@ -11,6 +6,11 @@ import Communication from 'newsletter_editor/components/communication';
/* eslint-disable-next-line max-len (ES6 -> CommonJS transform needed for inject-loader) */
import AutomatedLatestContentInjector from 'inject-loader!babel-loader?plugins[]=@babel/plugin-transform-modules-commonjs!newsletter_editor/blocks/automatedLatestContent';
const expect = global.expect;
const sinon = global.sinon;
const Backbone = global.Backbone;
const jQuery = global.jQuery;
var EditorApplication = App;
var CommunicationComponent = Communication;

View File

@ -1,9 +1,9 @@
const expect = global.expect;
const sinon = global.sinon;
import App from 'newsletter_editor/App';
import ButtonBlock from 'newsletter_editor/blocks/button';
const expect = global.expect;
const sinon = global.sinon;
var EditorApplication = App;
var sandbox;

View File

@ -1,10 +1,10 @@
import App from 'newsletter_editor/App';
import ContainerBlock from 'newsletter_editor/blocks/container';
const expect = global.expect;
const sinon = global.sinon;
const Backbone = global.Backbone;
import App from 'newsletter_editor/App';
import ContainerBlock from 'newsletter_editor/blocks/container';
var EditorApplication = App;
describe('Container', function () {

View File

@ -1,9 +1,9 @@
const expect = global.expect;
const sinon = global.sinon;
import App from 'newsletter_editor/App';
import DividerBlock from 'newsletter_editor/blocks/divider';
const expect = global.expect;
const sinon = global.sinon;
var EditorApplication = App;
var sandbox;

View File

@ -1,9 +1,9 @@
const expect = global.expect;
const sinon = global.sinon;
import App from 'newsletter_editor/App';
import FooterBlock from 'newsletter_editor/blocks/footer';
const expect = global.expect;
const sinon = global.sinon;
var EditorApplication = App;
describe('Footer', function () {

View File

@ -1,9 +1,9 @@
const expect = global.expect;
const sinon = global.sinon;
import App from 'newsletter_editor/App';
import HeaderBlock from 'newsletter_editor/blocks/header';
const expect = global.expect;
const sinon = global.sinon;
var EditorApplication = App;
describe('Header', function () {

View File

@ -1,9 +1,9 @@
const expect = global.expect;
const sinon = global.sinon;
import App from 'newsletter_editor/App';
import ImageBlock from 'newsletter_editor/blocks/image';
const expect = global.expect;
const sinon = global.sinon;
var EditorApplication = App;
describe('Image', function () {

View File

@ -1,13 +1,13 @@
const expect = global.expect;
const sinon = global.sinon;
const Backbone = global.Backbone;
const jQuery = global.jQuery;
import App from 'newsletter_editor/App';
import Communication from 'newsletter_editor/components/communication';
import PostsBlock from 'newsletter_editor/blocks/posts';
import ContainerBlock from 'newsletter_editor/blocks/container';
const expect = global.expect;
const sinon = global.sinon;
const Backbone = global.Backbone;
const jQuery = global.jQuery;
var EditorApplication = App;
var CommunicationComponent = Communication;

View File

@ -1,10 +1,10 @@
const expect = global.expect;
const sinon = global.sinon;
import EditorApplication from 'newsletter_editor/App';
import SocialBlock from 'newsletter_editor/blocks/social';
import Backbone from 'backbone';
const expect = global.expect;
const sinon = global.sinon;
describe('Social', function () {
describe('block model', function () {
var model;

View File

@ -1,9 +1,9 @@
const expect = global.expect;
const sinon = global.sinon;
import App from 'newsletter_editor/App';
import SpacerBlock from 'newsletter_editor/blocks/spacer';
const expect = global.expect;
const sinon = global.sinon;
var EditorApplication = App;
describe('Spacer', function () {

View File

@ -1,9 +1,9 @@
const expect = global.expect;
const sinon = global.sinon;
import EditorApplication from 'newsletter_editor/App';
import TextBlock from 'newsletter_editor/blocks/text';
const expect = global.expect;
const sinon = global.sinon;
describe('Text', function () {
describe('model', function () {
var model;

View File

@ -1,10 +1,10 @@
/* eslint-disable-next-line max-len (ES6 -> CommonJS transform needed for inject-loader) */
import CommunicationInjector from 'inject-loader!babel-loader?plugins[]=@babel/plugin-transform-modules-commonjs!newsletter_editor/components/communication';
const expect = global.expect;
const jQuery = global.jQuery;
const sinon = global.sinon;
/* eslint-disable-next-line max-len (ES6 -> CommonJS transform needed for inject-loader) */
import CommunicationInjector from 'inject-loader!babel-loader?plugins[]=@babel/plugin-transform-modules-commonjs!newsletter_editor/components/communication';
describe('getPostTypes', function () {
it('fetches post types from the server', function () {
var module = CommunicationInjector({

View File

@ -1,7 +1,7 @@
const expect = global.expect;
import ConfigComponent from 'newsletter_editor/components/config';
const expect = global.expect;
describe('Config', function () {
it('loads and stores configuration', function () {
var model;

View File

@ -1,11 +1,11 @@
import App from 'newsletter_editor/App';
import ContentComponent from 'newsletter_editor/components/content';
const expect = global.expect;
const sinon = global.sinon;
const Backbone = global.Backbone;
const _ = global._;
import App from 'newsletter_editor/App';
import ContentComponent from 'newsletter_editor/components/content';
var EditorApplication = App;
describe('Content', function () {

View File

@ -1,8 +1,8 @@
import HeadingComponent from 'newsletter_editor/components/heading';
const expect = global.expect;
const Backbone = global.Backbone;
import HeadingComponent from 'newsletter_editor/components/heading';
describe('Heading', function () {
describe('view', function () {
var view;

View File

@ -1,6 +1,3 @@
const expect = global.expect;
const sinon = global.sinon;
import App from 'newsletter_editor/App';
import SaveComponent from 'newsletter_editor/components/save';
import jQuery from 'jquery';
@ -8,6 +5,9 @@ import jQuery from 'jquery';
/* eslint-disable-next-line max-len (ES6 -> CommonJS transform needed for inject-loader) */
import SaveInjector from 'inject-loader!babel-loader?plugins[]=@babel/plugin-transform-modules-commonjs!newsletter_editor/components/save';
const expect = global.expect;
const sinon = global.sinon;
var EditorApplication = App;
describe('Save', function () {

View File

@ -1,8 +1,8 @@
import SidebarComponent from 'newsletter_editor/components/sidebar';
const expect = global.expect;
const Backbone = global.Backbone;
import SidebarComponent from 'newsletter_editor/components/sidebar';
describe('Sidebar', function () {
describe('content view', function () {
var view;

View File

@ -1,9 +1,9 @@
const expect = global.expect;
const sinon = global.sinon;
import App from 'newsletter_editor/App';
import StylesComponent from 'newsletter_editor/components/styles';
const expect = global.expect;
const sinon = global.sinon;
var EditorApplication = App;
describe('Styles', function () {