Fix tests comma-dangle eslint rule [MAILPOET-1028]
This commit is contained in:
committed by
pavel-mailpoet
parent
66c6f52646
commit
f0c59ff635
@ -35,7 +35,6 @@
|
|||||||
"quote-props": 0,
|
"quote-props": 0,
|
||||||
"no-shadow": 0,
|
"no-shadow": 0,
|
||||||
"padded-blocks": 0,
|
"padded-blocks": 0,
|
||||||
"comma-dangle": 0,
|
|
||||||
"vars-on-top": 0,
|
"vars-on-top": 0,
|
||||||
"space-before-blocks": 0,
|
"space-before-blocks": 0,
|
||||||
"object-curly-spacing": 0,
|
"object-curly-spacing": 0,
|
||||||
|
@ -23,5 +23,5 @@ module.exports = {
|
|||||||
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);
|
||||||
},
|
}
|
||||||
};
|
};
|
||||||
|
@ -57,7 +57,7 @@ global.stubChannel = function (EditorApplication, returnObject) {
|
|||||||
trigger: function () {
|
trigger: function () {
|
||||||
},
|
},
|
||||||
on: function () {
|
on: function () {
|
||||||
},
|
}
|
||||||
}));
|
}));
|
||||||
};
|
};
|
||||||
global.stubConfig = function (EditorApplication, config) {
|
global.stubConfig = function (EditorApplication, config) {
|
||||||
@ -83,7 +83,7 @@ global.stubImage = function(defaultWidth, defaultHeight) {
|
|||||||
"set": function(src) {
|
"set": function(src) {
|
||||||
this.address = src;
|
this.address = src;
|
||||||
this.onload();
|
this.onload();
|
||||||
},
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@ -225,5 +225,5 @@ global.templates = {
|
|||||||
|
|
||||||
textBlock: Handlebars.compile(jQuery('#newsletter_editor_template_text_block').html()),
|
textBlock: Handlebars.compile(jQuery('#newsletter_editor_template_text_block').html()),
|
||||||
textInsertion: Handlebars.compile(jQuery('#newsletter_editor_template_text_widget').html()),
|
textInsertion: Handlebars.compile(jQuery('#newsletter_editor_template_text_widget').html()),
|
||||||
textBlockSettings: Handlebars.compile(jQuery('#newsletter_editor_template_text_settings').html()),
|
textBlockSettings: Handlebars.compile(jQuery('#newsletter_editor_template_text_settings').html())
|
||||||
};
|
};
|
||||||
|
@ -3,7 +3,7 @@ define([
|
|||||||
'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(
|
||||||
EditorApplication,
|
EditorApplication,
|
||||||
AutomatedLatestContentBlock,
|
AutomatedLatestContentBlock,
|
||||||
@ -28,7 +28,7 @@ define([
|
|||||||
var module = AutomatedLatestContentInjector({
|
var module = AutomatedLatestContentInjector({
|
||||||
'newsletter_editor/components/communication': {
|
'newsletter_editor/components/communication': {
|
||||||
getBulkTransformedPosts: mock
|
getBulkTransformedPosts: mock
|
||||||
},
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
var model = new module.ALCSupervisor();
|
var model = new module.ALCSupervisor();
|
||||||
@ -41,11 +41,11 @@ define([
|
|||||||
var block1 = new Backbone.SuperModel(),
|
var block1 = new Backbone.SuperModel(),
|
||||||
block2 = new Backbone.SuperModel(),
|
block2 = new Backbone.SuperModel(),
|
||||||
postsSet1 = [
|
postsSet1 = [
|
||||||
{ type: 'customTypeOne' },
|
{ type: 'customTypeOne' }
|
||||||
],
|
],
|
||||||
postsSet2 = [
|
postsSet2 = [
|
||||||
{ type: 'customTypeTwo' },
|
{ type: 'customTypeTwo' },
|
||||||
{ type: 'customTypeTwo' },
|
{ type: 'customTypeTwo' }
|
||||||
],
|
],
|
||||||
mock1 = sinon.mock(block1),
|
mock1 = sinon.mock(block1),
|
||||||
mock2 = sinon.mock(block2);
|
mock2 = sinon.mock(block2);
|
||||||
@ -189,14 +189,14 @@ define([
|
|||||||
styles: {
|
styles: {
|
||||||
block: {
|
block: {
|
||||||
backgroundColor: '#123456',
|
backgroundColor: '#123456',
|
||||||
borderColor: '#234567',
|
borderColor: '#234567'
|
||||||
},
|
},
|
||||||
link: {
|
link: {
|
||||||
fontColor: '#345678',
|
fontColor: '#345678',
|
||||||
fontFamily: 'Tahoma',
|
fontFamily: 'Tahoma',
|
||||||
fontSize: '37px',
|
fontSize: '37px'
|
||||||
},
|
}
|
||||||
},
|
}
|
||||||
},
|
},
|
||||||
sortBy: 'oldest', // 'newest'|'oldest',
|
sortBy: 'oldest', // 'newest'|'oldest',
|
||||||
showDivider: true, // true|false
|
showDivider: true, // true|false
|
||||||
@ -205,12 +205,12 @@ define([
|
|||||||
styles: {
|
styles: {
|
||||||
block: {
|
block: {
|
||||||
backgroundColor: '#456789',
|
backgroundColor: '#456789',
|
||||||
padding: '38px',
|
padding: '38px'
|
||||||
},
|
}
|
||||||
},
|
}
|
||||||
},
|
}
|
||||||
},
|
}
|
||||||
},
|
}
|
||||||
});
|
});
|
||||||
var model = new (module.AutomatedLatestContentBlockModel)();
|
var model = new (module.AutomatedLatestContentBlockModel)();
|
||||||
|
|
||||||
@ -248,7 +248,7 @@ define([
|
|||||||
var model = new (module.AutomatedLatestContentBlockModel)();
|
var model = new (module.AutomatedLatestContentBlockModel)();
|
||||||
|
|
||||||
model.updatePosts([{
|
model.updatePosts([{
|
||||||
type: 'someCustomType',
|
type: 'someCustomType'
|
||||||
}]);
|
}]);
|
||||||
|
|
||||||
expect(model.get('_container.blocks').size()).to.equal(1);
|
expect(model.get('_container.blocks').size()).to.equal(1);
|
||||||
@ -309,9 +309,9 @@ define([
|
|||||||
const data = {
|
const data = {
|
||||||
styles: {
|
styles: {
|
||||||
block: {
|
block: {
|
||||||
borderRadius: "14px",
|
borderRadius: "14px"
|
||||||
},
|
}
|
||||||
},
|
}
|
||||||
};
|
};
|
||||||
callback(data);
|
callback(data);
|
||||||
expect(model.set).to.have.been.calledOnce;
|
expect(model.set).to.have.been.calledOnce;
|
||||||
@ -328,7 +328,7 @@ define([
|
|||||||
getPostTypes: function() {
|
getPostTypes: function() {
|
||||||
return jQuery.Deferred();
|
return jQuery.Deferred();
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -339,28 +339,28 @@ define([
|
|||||||
{
|
{
|
||||||
name: 'post',
|
name: 'post',
|
||||||
labels: {
|
labels: {
|
||||||
singular_name: 'Post',
|
singular_name: 'Post'
|
||||||
},
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'page',
|
name: 'page',
|
||||||
labels: {
|
labels: {
|
||||||
singular_name: 'Page',
|
singular_name: 'Page'
|
||||||
},
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'mailpoet_page',
|
name: 'mailpoet_page',
|
||||||
labels: {
|
labels: {
|
||||||
singular_name: 'Mailpoet page',
|
singular_name: 'Mailpoet page'
|
||||||
},
|
}
|
||||||
},
|
}
|
||||||
]);
|
]);
|
||||||
return deferred;
|
return deferred;
|
||||||
};
|
};
|
||||||
|
|
||||||
global.stubChannel(EditorApplication);
|
global.stubChannel(EditorApplication);
|
||||||
global.stubConfig(EditorApplication, {
|
global.stubConfig(EditorApplication, {
|
||||||
blockDefaults: {},
|
blockDefaults: {}
|
||||||
});
|
});
|
||||||
EditorApplication.getBlockTypeModel = sinon.stub().returns(Backbone.Model);
|
EditorApplication.getBlockTypeModel = sinon.stub().returns(Backbone.Model);
|
||||||
EditorApplication.getBlockTypeView = sinon.stub().returns(Backbone.View);
|
EditorApplication.getBlockTypeView = sinon.stub().returns(Backbone.View);
|
||||||
|
@ -10,7 +10,7 @@ define([
|
|||||||
beforeEach(function () {
|
beforeEach(function () {
|
||||||
global.stubChannel(EditorApplication);
|
global.stubChannel(EditorApplication);
|
||||||
global.stubConfig(EditorApplication, {
|
global.stubConfig(EditorApplication, {
|
||||||
blockDefaults: {},
|
blockDefaults: {}
|
||||||
});
|
});
|
||||||
model = new (ButtonBlock.ButtonBlockModel)();
|
model = new (ButtonBlock.ButtonBlockModel)();
|
||||||
});
|
});
|
||||||
@ -86,7 +86,7 @@ define([
|
|||||||
it("triggers autosave if any attribute changes", function () {
|
it("triggers autosave if any attribute changes", function () {
|
||||||
var mock = sinon.mock().exactly(12).withArgs('autoSave');
|
var mock = sinon.mock().exactly(12).withArgs('autoSave');
|
||||||
EditorApplication.getChannel = sinon.stub().returns({
|
EditorApplication.getChannel = sinon.stub().returns({
|
||||||
trigger: mock,
|
trigger: mock
|
||||||
});
|
});
|
||||||
model.set('text', 'some other text');
|
model.set('text', 'some other text');
|
||||||
model.set('url', 'some url');
|
model.set('url', 'some url');
|
||||||
@ -121,11 +121,11 @@ define([
|
|||||||
fontColor: '#345678',
|
fontColor: '#345678',
|
||||||
fontFamily: 'Tahoma',
|
fontFamily: 'Tahoma',
|
||||||
fontSize: '30px',
|
fontSize: '30px',
|
||||||
fontWeight: 'bold',
|
fontWeight: 'bold'
|
||||||
},
|
}
|
||||||
},
|
}
|
||||||
},
|
}
|
||||||
},
|
}
|
||||||
});
|
});
|
||||||
var model = new (ButtonBlock.ButtonBlockModel)();
|
var model = new (ButtonBlock.ButtonBlockModel)();
|
||||||
|
|
||||||
@ -188,9 +188,9 @@ define([
|
|||||||
fontColor: '#345678',
|
fontColor: '#345678',
|
||||||
fontFamily: 'Arial',
|
fontFamily: 'Arial',
|
||||||
fontSize: '12px',
|
fontSize: '12px',
|
||||||
fontWeight: 'bold',
|
fontWeight: 'bold'
|
||||||
},
|
}
|
||||||
},
|
}
|
||||||
});
|
});
|
||||||
view = new (ButtonBlock.ButtonBlockView)({model: model});
|
view = new (ButtonBlock.ButtonBlockView)({model: model});
|
||||||
view.render();
|
view.render();
|
||||||
@ -281,9 +281,9 @@ define([
|
|||||||
const data = {
|
const data = {
|
||||||
styles: {
|
styles: {
|
||||||
block: {
|
block: {
|
||||||
borderRadius: "14px",
|
borderRadius: "14px"
|
||||||
},
|
}
|
||||||
},
|
}
|
||||||
};
|
};
|
||||||
callback(data);
|
callback(data);
|
||||||
expect(model.set).to.have.been.calledOnce;
|
expect(model.set).to.have.been.calledOnce;
|
||||||
@ -298,12 +298,12 @@ define([
|
|||||||
global.stubChannel(EditorApplication);
|
global.stubChannel(EditorApplication);
|
||||||
global.stubAvailableStyles(EditorApplication, {
|
global.stubAvailableStyles(EditorApplication, {
|
||||||
fonts: ['Arial', 'Tahoma'],
|
fonts: ['Arial', 'Tahoma'],
|
||||||
headingSizes: ['16px', '20px'],
|
headingSizes: ['16px', '20px']
|
||||||
});
|
});
|
||||||
|
|
||||||
model = new (ButtonBlock.ButtonBlockModel)({
|
model = new (ButtonBlock.ButtonBlockModel)({
|
||||||
type: 'button',
|
type: 'button',
|
||||||
text: 'Some random text',
|
text: 'Some random text'
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -319,14 +319,14 @@ define([
|
|||||||
global.stubConfig(EditorApplication);
|
global.stubConfig(EditorApplication);
|
||||||
global.stubAvailableStyles(EditorApplication, {
|
global.stubAvailableStyles(EditorApplication, {
|
||||||
fonts: ['Arial', 'Tahoma'],
|
fonts: ['Arial', 'Tahoma'],
|
||||||
headingSizes: ['16px', '20px'],
|
headingSizes: ['16px', '20px']
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
beforeEach(function() {
|
beforeEach(function() {
|
||||||
model = new (ButtonBlock.ButtonBlockModel)({
|
model = new (ButtonBlock.ButtonBlockModel)({
|
||||||
type: 'button',
|
type: 'button',
|
||||||
text: 'Some random text',
|
text: 'Some random text'
|
||||||
});
|
});
|
||||||
view = new (ButtonBlock.ButtonBlockSettingsView)({model: model});
|
view = new (ButtonBlock.ButtonBlockSettingsView)({model: model});
|
||||||
|
|
||||||
@ -449,8 +449,8 @@ define([
|
|||||||
view = new (ButtonBlock.ButtonBlockSettingsView)({
|
view = new (ButtonBlock.ButtonBlockSettingsView)({
|
||||||
model: model,
|
model: model,
|
||||||
renderOptions: {
|
renderOptions: {
|
||||||
hideLink: true,
|
hideLink: true
|
||||||
},
|
}
|
||||||
});
|
});
|
||||||
view.render();
|
view.render();
|
||||||
expect(view.$('.mailpoet_field_button_url').length).to.equal(0);
|
expect(view.$('.mailpoet_field_button_url').length).to.equal(0);
|
||||||
@ -460,8 +460,8 @@ define([
|
|||||||
view = new (ButtonBlock.ButtonBlockSettingsView)({
|
view = new (ButtonBlock.ButtonBlockSettingsView)({
|
||||||
model: model,
|
model: model,
|
||||||
renderOptions: {
|
renderOptions: {
|
||||||
hideApplyToAll: true,
|
hideApplyToAll: true
|
||||||
},
|
}
|
||||||
});
|
});
|
||||||
view.render();
|
view.render();
|
||||||
expect(view.$('.mailpoet_field_button_replace_all_styles').length).to.equal(0);
|
expect(view.$('.mailpoet_field_button_replace_all_styles').length).to.equal(0);
|
||||||
|
@ -33,11 +33,11 @@ define([
|
|||||||
container: {
|
container: {
|
||||||
styles: {
|
styles: {
|
||||||
block: {
|
block: {
|
||||||
backgroundColor: '#123456',
|
backgroundColor: '#123456'
|
||||||
},
|
}
|
||||||
},
|
}
|
||||||
},
|
}
|
||||||
},
|
}
|
||||||
});
|
});
|
||||||
var model = new (ContainerBlock.ContainerBlockModel)();
|
var model = new (ContainerBlock.ContainerBlockModel)();
|
||||||
|
|
||||||
@ -48,7 +48,7 @@ define([
|
|||||||
describe('when creating with children', function () {
|
describe('when creating with children', function () {
|
||||||
var testModel = {
|
var testModel = {
|
||||||
type: 'sampleType',
|
type: 'sampleType',
|
||||||
someField: 'Some Content',
|
someField: 'Some Content'
|
||||||
},
|
},
|
||||||
model;
|
model;
|
||||||
|
|
||||||
@ -57,7 +57,7 @@ define([
|
|||||||
|
|
||||||
model = new (ContainerBlock.ContainerBlockModel)({
|
model = new (ContainerBlock.ContainerBlockModel)({
|
||||||
type: 'container',
|
type: 'container',
|
||||||
blocks: [testModel],
|
blocks: [testModel]
|
||||||
}, {parse: true});
|
}, {parse: true});
|
||||||
|
|
||||||
expect(model.get('blocks')).to.have.length(1);
|
expect(model.get('blocks')).to.have.length(1);
|
||||||
@ -79,15 +79,15 @@ define([
|
|||||||
blocks: [
|
blocks: [
|
||||||
{
|
{
|
||||||
type: 'someType',
|
type: 'someType',
|
||||||
someField: 'some text',
|
someField: 'some text'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type: 'someType',
|
type: 'someType',
|
||||||
someField: 'some text 2',
|
someField: 'some text 2'
|
||||||
},
|
}
|
||||||
],
|
]
|
||||||
}
|
}
|
||||||
],
|
]
|
||||||
}, {parse: true});
|
}, {parse: true});
|
||||||
|
|
||||||
expect(model.get('blocks')).to.have.length(1);
|
expect(model.get('blocks')).to.have.length(1);
|
||||||
@ -119,8 +119,8 @@ define([
|
|||||||
view = new (ContainerBlock.ContainerBlockView)({
|
view = new (ContainerBlock.ContainerBlockView)({
|
||||||
model: model,
|
model: model,
|
||||||
renderOptions: {
|
renderOptions: {
|
||||||
depth: 0,
|
depth: 0
|
||||||
},
|
}
|
||||||
});
|
});
|
||||||
view.render();
|
view.render();
|
||||||
});
|
});
|
||||||
@ -151,8 +151,8 @@ define([
|
|||||||
view = new (ContainerBlock.ContainerBlockView)({
|
view = new (ContainerBlock.ContainerBlockView)({
|
||||||
model: model,
|
model: model,
|
||||||
renderOptions: {
|
renderOptions: {
|
||||||
depth: 1,
|
depth: 1
|
||||||
},
|
}
|
||||||
});
|
});
|
||||||
view.render();
|
view.render();
|
||||||
});
|
});
|
||||||
|
@ -10,7 +10,7 @@ define([
|
|||||||
beforeEach(function () {
|
beforeEach(function () {
|
||||||
global.stubChannel(EditorApplication);
|
global.stubChannel(EditorApplication);
|
||||||
global.stubConfig(EditorApplication, {
|
global.stubConfig(EditorApplication, {
|
||||||
blockDefaults: {},
|
blockDefaults: {}
|
||||||
});
|
});
|
||||||
global.stubAvailableStyles(EditorApplication);
|
global.stubAvailableStyles(EditorApplication);
|
||||||
model = new (DividerBlock.DividerBlockModel)();
|
model = new (DividerBlock.DividerBlockModel)();
|
||||||
@ -53,7 +53,7 @@ define([
|
|||||||
it("triggers autosave if any attribute changes", function () {
|
it("triggers autosave if any attribute changes", function () {
|
||||||
var mock = sinon.mock().exactly(5).withArgs('autoSave');
|
var mock = sinon.mock().exactly(5).withArgs('autoSave');
|
||||||
EditorApplication.getChannel = sinon.stub().returns({
|
EditorApplication.getChannel = sinon.stub().returns({
|
||||||
trigger: mock,
|
trigger: mock
|
||||||
});
|
});
|
||||||
|
|
||||||
model.set('styles.block.backgroundColor', '#000000');
|
model.set('styles.block.backgroundColor', '#000000');
|
||||||
@ -75,11 +75,11 @@ define([
|
|||||||
padding: '37px',
|
padding: '37px',
|
||||||
borderStyle: 'inset',
|
borderStyle: 'inset',
|
||||||
borderWidth: '7px',
|
borderWidth: '7px',
|
||||||
borderColor: '#345678',
|
borderColor: '#345678'
|
||||||
},
|
}
|
||||||
},
|
}
|
||||||
},
|
}
|
||||||
},
|
}
|
||||||
});
|
});
|
||||||
var model = new (DividerBlock.DividerBlockModel)();
|
var model = new (DividerBlock.DividerBlockModel)();
|
||||||
|
|
||||||
@ -136,7 +136,7 @@ define([
|
|||||||
global.stubChannel(EditorApplication);
|
global.stubChannel(EditorApplication);
|
||||||
global.stubConfig(EditorApplication);
|
global.stubConfig(EditorApplication);
|
||||||
global.stubAvailableStyles(EditorApplication, {
|
global.stubAvailableStyles(EditorApplication, {
|
||||||
dividers: ['solid', 'inset'],
|
dividers: ['solid', 'inset']
|
||||||
});
|
});
|
||||||
var model = new (DividerBlock.DividerBlockModel)(),
|
var model = new (DividerBlock.DividerBlockModel)(),
|
||||||
view = new (DividerBlock.DividerBlockSettingsView)({model: model});
|
view = new (DividerBlock.DividerBlockSettingsView)({model: model});
|
||||||
@ -152,7 +152,7 @@ define([
|
|||||||
before(function() {
|
before(function() {
|
||||||
global.stubChannel(EditorApplication);
|
global.stubChannel(EditorApplication);
|
||||||
global.stubAvailableStyles(EditorApplication, {
|
global.stubAvailableStyles(EditorApplication, {
|
||||||
dividers: ['solid', 'inset'],
|
dividers: ['solid', 'inset']
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -202,8 +202,8 @@ define([
|
|||||||
view = new (DividerBlock.DividerBlockSettingsView)({
|
view = new (DividerBlock.DividerBlockSettingsView)({
|
||||||
model: model,
|
model: model,
|
||||||
renderOptions: {
|
renderOptions: {
|
||||||
hideApplyToAll: true,
|
hideApplyToAll: true
|
||||||
},
|
}
|
||||||
});
|
});
|
||||||
view.render();
|
view.render();
|
||||||
expect(view.$('.mailpoet_button_divider_apply_to_all').length).to.equal(0);
|
expect(view.$('.mailpoet_button_divider_apply_to_all').length).to.equal(0);
|
||||||
|
@ -9,7 +9,7 @@ define([
|
|||||||
beforeEach(function () {
|
beforeEach(function () {
|
||||||
global.stubChannel(EditorApplication);
|
global.stubChannel(EditorApplication);
|
||||||
global.stubConfig(EditorApplication, {
|
global.stubConfig(EditorApplication, {
|
||||||
blockDefaults: {},
|
blockDefaults: {}
|
||||||
});
|
});
|
||||||
model = new (FooterBlock.FooterBlockModel)();
|
model = new (FooterBlock.FooterBlockModel)();
|
||||||
});
|
});
|
||||||
@ -59,7 +59,7 @@ define([
|
|||||||
it('triggers autosave when any of the attributes change', function () {
|
it('triggers autosave when any of the attributes change', function () {
|
||||||
var mock = sinon.mock().exactly(8).withArgs('autoSave');
|
var mock = sinon.mock().exactly(8).withArgs('autoSave');
|
||||||
EditorApplication.getChannel = sinon.stub().returns({
|
EditorApplication.getChannel = sinon.stub().returns({
|
||||||
trigger: mock,
|
trigger: mock
|
||||||
});
|
});
|
||||||
|
|
||||||
model.set('text', 'Some new text');
|
model.set('text', 'Some new text');
|
||||||
@ -81,21 +81,21 @@ define([
|
|||||||
text: 'some custom config text',
|
text: 'some custom config text',
|
||||||
styles: {
|
styles: {
|
||||||
block: {
|
block: {
|
||||||
backgroundColor: '#123456',
|
backgroundColor: '#123456'
|
||||||
},
|
},
|
||||||
text: {
|
text: {
|
||||||
fontColor: '#234567',
|
fontColor: '#234567',
|
||||||
fontFamily: 'Tahoma',
|
fontFamily: 'Tahoma',
|
||||||
fontSize: '37px',
|
fontSize: '37px',
|
||||||
textAlign: 'right',
|
textAlign: 'right'
|
||||||
},
|
},
|
||||||
link: {
|
link: {
|
||||||
fontColor: '#345678',
|
fontColor: '#345678',
|
||||||
textDecoration: 'underline',
|
textDecoration: 'underline'
|
||||||
},
|
}
|
||||||
},
|
}
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
});
|
});
|
||||||
var model = new (FooterBlock.FooterBlockModel)();
|
var model = new (FooterBlock.FooterBlockModel)();
|
||||||
|
|
||||||
@ -133,7 +133,7 @@ define([
|
|||||||
global.stubChannel(EditorApplication);
|
global.stubChannel(EditorApplication);
|
||||||
global.stubAvailableStyles(EditorApplication, {
|
global.stubAvailableStyles(EditorApplication, {
|
||||||
fonts: ['Arial', 'Tahoma'],
|
fonts: ['Arial', 'Tahoma'],
|
||||||
textSizes: ['16px', '20px'],
|
textSizes: ['16px', '20px']
|
||||||
});
|
});
|
||||||
var model = new (FooterBlock.FooterBlockModel)(),
|
var model = new (FooterBlock.FooterBlockModel)(),
|
||||||
view = new (FooterBlock.FooterBlockSettingsView)({model: model});
|
view = new (FooterBlock.FooterBlockSettingsView)({model: model});
|
||||||
@ -150,7 +150,7 @@ define([
|
|||||||
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)({});
|
model = new (FooterBlock.FooterBlockModel)({});
|
||||||
view = new (FooterBlock.FooterBlockSettingsView)({model: model});
|
view = new (FooterBlock.FooterBlockSettingsView)({model: model});
|
||||||
|
@ -9,7 +9,7 @@ define([
|
|||||||
beforeEach(function () {
|
beforeEach(function () {
|
||||||
global.stubChannel(EditorApplication);
|
global.stubChannel(EditorApplication);
|
||||||
global. stubConfig(EditorApplication, {
|
global. stubConfig(EditorApplication, {
|
||||||
blockDefaults: {},
|
blockDefaults: {}
|
||||||
});
|
});
|
||||||
model = new (HeaderBlock.HeaderBlockModel)();
|
model = new (HeaderBlock.HeaderBlockModel)();
|
||||||
});
|
});
|
||||||
@ -59,7 +59,7 @@ define([
|
|||||||
it("triggers autosave if any attribute changes", function () {
|
it("triggers autosave if any attribute changes", function () {
|
||||||
var mock = sinon.mock().exactly(8).withArgs('autoSave');
|
var mock = sinon.mock().exactly(8).withArgs('autoSave');
|
||||||
EditorApplication.getChannel = sinon.stub().returns({
|
EditorApplication.getChannel = sinon.stub().returns({
|
||||||
trigger: mock,
|
trigger: mock
|
||||||
});
|
});
|
||||||
|
|
||||||
model.set('text', 'Some new text');
|
model.set('text', 'Some new text');
|
||||||
@ -81,21 +81,21 @@ define([
|
|||||||
text: 'some custom config text',
|
text: 'some custom config text',
|
||||||
styles: {
|
styles: {
|
||||||
block: {
|
block: {
|
||||||
backgroundColor: '#123456',
|
backgroundColor: '#123456'
|
||||||
},
|
},
|
||||||
text: {
|
text: {
|
||||||
fontColor: '#234567',
|
fontColor: '#234567',
|
||||||
fontFamily: 'Tahoma',
|
fontFamily: 'Tahoma',
|
||||||
fontSize: '37px',
|
fontSize: '37px',
|
||||||
textAlign: 'right',
|
textAlign: 'right'
|
||||||
},
|
},
|
||||||
link: {
|
link: {
|
||||||
fontColor: '#345678',
|
fontColor: '#345678',
|
||||||
textDecoration: 'underline',
|
textDecoration: 'underline'
|
||||||
},
|
}
|
||||||
},
|
}
|
||||||
},
|
}
|
||||||
},
|
}
|
||||||
});
|
});
|
||||||
var model = new (HeaderBlock.HeaderBlockModel)();
|
var model = new (HeaderBlock.HeaderBlockModel)();
|
||||||
|
|
||||||
@ -133,7 +133,7 @@ define([
|
|||||||
global.stubConfig(EditorApplication);
|
global.stubConfig(EditorApplication);
|
||||||
global.stubAvailableStyles(EditorApplication, {
|
global.stubAvailableStyles(EditorApplication, {
|
||||||
fonts: ['Arial', 'Tahoma'],
|
fonts: ['Arial', 'Tahoma'],
|
||||||
textSizes: ['16px', '20px'],
|
textSizes: ['16px', '20px']
|
||||||
});
|
});
|
||||||
var model = new (HeaderBlock.HeaderBlockModel)(),
|
var model = new (HeaderBlock.HeaderBlockModel)(),
|
||||||
view = new (HeaderBlock.HeaderBlockSettingsView)({model: model});
|
view = new (HeaderBlock.HeaderBlockSettingsView)({model: model});
|
||||||
@ -150,7 +150,7 @@ define([
|
|||||||
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)({});
|
model = new (HeaderBlock.HeaderBlockModel)({});
|
||||||
view = new (HeaderBlock.HeaderBlockSettingsView)({model: model});
|
view = new (HeaderBlock.HeaderBlockSettingsView)({model: model});
|
||||||
|
@ -9,7 +9,7 @@ define([
|
|||||||
beforeEach(function () {
|
beforeEach(function () {
|
||||||
global.stubChannel(EditorApplication);
|
global.stubChannel(EditorApplication);
|
||||||
global.stubConfig(EditorApplication, {
|
global.stubConfig(EditorApplication, {
|
||||||
blockDefaults: {},
|
blockDefaults: {}
|
||||||
});
|
});
|
||||||
model = new (ImageBlock.ImageBlockModel)();
|
model = new (ImageBlock.ImageBlockModel)();
|
||||||
});
|
});
|
||||||
@ -55,7 +55,7 @@ define([
|
|||||||
it('triggers autosave when any of the attributes change', function () {
|
it('triggers autosave when any of the attributes change', function () {
|
||||||
var mock = sinon.mock().exactly(7).withArgs('autoSave');
|
var mock = sinon.mock().exactly(7).withArgs('autoSave');
|
||||||
EditorApplication.getChannel = sinon.stub().returns({
|
EditorApplication.getChannel = sinon.stub().returns({
|
||||||
trigger: mock,
|
trigger: mock
|
||||||
});
|
});
|
||||||
|
|
||||||
model.set('link', 'http://example.net');
|
model.set('link', 'http://example.net');
|
||||||
@ -81,11 +81,11 @@ define([
|
|||||||
height: '2345px',
|
height: '2345px',
|
||||||
styles: {
|
styles: {
|
||||||
block: {
|
block: {
|
||||||
textAlign: 'right',
|
textAlign: 'right'
|
||||||
},
|
}
|
||||||
},
|
}
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
});
|
});
|
||||||
var model = new (ImageBlock.ImageBlockModel)();
|
var model = new (ImageBlock.ImageBlockModel)();
|
||||||
|
|
||||||
@ -125,7 +125,7 @@ define([
|
|||||||
model = new (ImageBlock.ImageBlockModel)({
|
model = new (ImageBlock.ImageBlockModel)({
|
||||||
link: 'http://example.org/somepath',
|
link: 'http://example.org/somepath',
|
||||||
src: 'http://example.org/someimage.png',
|
src: 'http://example.org/someimage.png',
|
||||||
alt: 'some alt',
|
alt: 'some alt'
|
||||||
});
|
});
|
||||||
view = new (ImageBlock.ImageBlockView)({model: model});
|
view = new (ImageBlock.ImageBlockView)({model: model});
|
||||||
view.render();
|
view.render();
|
||||||
@ -163,7 +163,7 @@ define([
|
|||||||
before(function () {
|
before(function () {
|
||||||
global.stubChannel(EditorApplication);
|
global.stubChannel(EditorApplication);
|
||||||
global.stubConfig(EditorApplication, {
|
global.stubConfig(EditorApplication, {
|
||||||
blockDefaults: {},
|
blockDefaults: {}
|
||||||
});
|
});
|
||||||
global.stubImage(newWidth, newHeight);
|
global.stubImage(newWidth, newHeight);
|
||||||
model = new (ImageBlock.ImageBlockModel)();
|
model = new (ImageBlock.ImageBlockModel)();
|
||||||
|
@ -10,8 +10,8 @@ define([
|
|||||||
Requests: {
|
Requests: {
|
||||||
request: function () {
|
request: function () {
|
||||||
}, reply: function () {
|
}, reply: function () {
|
||||||
},
|
}
|
||||||
},
|
}
|
||||||
};
|
};
|
||||||
describe('model', function () {
|
describe('model', function () {
|
||||||
var model;
|
var model;
|
||||||
@ -148,14 +148,14 @@ define([
|
|||||||
styles: {
|
styles: {
|
||||||
block: {
|
block: {
|
||||||
backgroundColor: '#123456',
|
backgroundColor: '#123456',
|
||||||
borderColor: '#234567',
|
borderColor: '#234567'
|
||||||
},
|
},
|
||||||
link: {
|
link: {
|
||||||
fontColor: '#345678',
|
fontColor: '#345678',
|
||||||
fontFamily: 'Tahoma',
|
fontFamily: 'Tahoma',
|
||||||
fontSize: '37px',
|
fontSize: '37px'
|
||||||
},
|
}
|
||||||
},
|
}
|
||||||
},
|
},
|
||||||
sortBy: 'oldest', // 'newest'|'oldest',
|
sortBy: 'oldest', // 'newest'|'oldest',
|
||||||
showDivider: true, // true|false
|
showDivider: true, // true|false
|
||||||
@ -164,12 +164,12 @@ define([
|
|||||||
styles: {
|
styles: {
|
||||||
block: {
|
block: {
|
||||||
backgroundColor: '#456789',
|
backgroundColor: '#456789',
|
||||||
padding: '38px',
|
padding: '38px'
|
||||||
},
|
}
|
||||||
},
|
}
|
||||||
},
|
}
|
||||||
},
|
}
|
||||||
},
|
}
|
||||||
});
|
});
|
||||||
var model = new (PostsBlock.PostsBlockModel)();
|
var model = new (PostsBlock.PostsBlockModel)();
|
||||||
|
|
||||||
@ -286,28 +286,28 @@ define([
|
|||||||
{
|
{
|
||||||
name: 'post',
|
name: 'post',
|
||||||
labels: {
|
labels: {
|
||||||
singular_name: 'Post',
|
singular_name: 'Post'
|
||||||
},
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'page',
|
name: 'page',
|
||||||
labels: {
|
labels: {
|
||||||
singular_name: 'Page',
|
singular_name: 'Page'
|
||||||
},
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'mailpoet_page',
|
name: 'mailpoet_page',
|
||||||
labels: {
|
labels: {
|
||||||
singular_name: 'Mailpoet page',
|
singular_name: 'Mailpoet page'
|
||||||
},
|
}
|
||||||
},
|
}
|
||||||
]);
|
]);
|
||||||
return deferred;
|
return deferred;
|
||||||
};
|
};
|
||||||
|
|
||||||
global.stubChannel(EditorApplication);
|
global.stubChannel(EditorApplication);
|
||||||
global.stubConfig(EditorApplication, {
|
global.stubConfig(EditorApplication, {
|
||||||
blockDefaults: {},
|
blockDefaults: {}
|
||||||
});
|
});
|
||||||
EditorApplication.getBlockTypeModel = sinon.stub().returns(ContainerBlock.ContainerBlockModel);
|
EditorApplication.getBlockTypeModel = sinon.stub().returns(ContainerBlock.ContainerBlockModel);
|
||||||
model = new (PostsBlock.PostsBlockModel)();
|
model = new (PostsBlock.PostsBlockModel)();
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
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 () {
|
||||||
@ -29,9 +29,9 @@ define([
|
|||||||
global.stubConfig(EditorApplication, {
|
global.stubConfig(EditorApplication, {
|
||||||
blockDefaults: {
|
blockDefaults: {
|
||||||
social: {
|
social: {
|
||||||
iconSet: 'customConfigIconSet',
|
iconSet: 'customConfigIconSet'
|
||||||
},
|
}
|
||||||
},
|
}
|
||||||
});
|
});
|
||||||
var model = new (SocialBlock.SocialBlockModel)();
|
var model = new (SocialBlock.SocialBlockModel)();
|
||||||
|
|
||||||
@ -44,15 +44,15 @@ define([
|
|||||||
before(function () {
|
before(function () {
|
||||||
global.stubChannel(EditorApplication);
|
global.stubChannel(EditorApplication);
|
||||||
global.stubAvailableStyles(EditorApplication, {
|
global.stubAvailableStyles(EditorApplication, {
|
||||||
'socialIconSets.default.custom': 'someimage.jpg',
|
'socialIconSets.default.custom': 'someimage.jpg'
|
||||||
});
|
});
|
||||||
global.stubConfig(EditorApplication, {
|
global.stubConfig(EditorApplication, {
|
||||||
socialIcons: {
|
socialIcons: {
|
||||||
custom: {
|
custom: {
|
||||||
defaultLink: 'http://example.org',
|
defaultLink: 'http://example.org',
|
||||||
title: 'sometitle',
|
title: 'sometitle'
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
});
|
});
|
||||||
model = new (SocialBlock.SocialIconModel)();
|
model = new (SocialBlock.SocialIconModel)();
|
||||||
});
|
});
|
||||||
@ -91,19 +91,19 @@ define([
|
|||||||
global.stubAvailableStyles(EditorApplication, {
|
global.stubAvailableStyles(EditorApplication, {
|
||||||
socialIconSets: {
|
socialIconSets: {
|
||||||
'default': {
|
'default': {
|
||||||
'custom': 'http://www.sott.net/images/icons/big_x.png',
|
'custom': 'http://www.sott.net/images/icons/big_x.png'
|
||||||
},
|
},
|
||||||
'light': {
|
'light': {
|
||||||
'custom': 'http://content.indiainfoline.com/wc/news/ImageGallery/css/close_32x32.png',
|
'custom': 'http://content.indiainfoline.com/wc/news/ImageGallery/css/close_32x32.png'
|
||||||
},
|
}
|
||||||
},
|
},
|
||||||
socialIcons: {
|
socialIcons: {
|
||||||
'custom': {
|
'custom': {
|
||||||
title: 'Custom',
|
title: 'Custom',
|
||||||
linkFieldName: 'Page URL',
|
linkFieldName: 'Page URL',
|
||||||
defaultLink: 'http://example.org',
|
defaultLink: 'http://example.org'
|
||||||
},
|
}
|
||||||
},
|
}
|
||||||
});
|
});
|
||||||
model = new (SocialBlock.SocialBlockModel)({
|
model = new (SocialBlock.SocialBlockModel)({
|
||||||
type: 'social',
|
type: 'social',
|
||||||
@ -114,9 +114,9 @@ define([
|
|||||||
iconType: 'custom',
|
iconType: 'custom',
|
||||||
link: 'somelink.htm',
|
link: 'somelink.htm',
|
||||||
image: 'someimage.png',
|
image: 'someimage.png',
|
||||||
text: 'some text',
|
text: 'some text'
|
||||||
}
|
}
|
||||||
],
|
]
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -140,16 +140,16 @@ define([
|
|||||||
iconType: 'custom',
|
iconType: 'custom',
|
||||||
link: 'http://example.org/',
|
link: 'http://example.org/',
|
||||||
image: 'http://example.org/someimage.png',
|
image: 'http://example.org/someimage.png',
|
||||||
text: 'some text',
|
text: 'some text'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type: 'socialIcon',
|
type: 'socialIcon',
|
||||||
iconType: 'facebook',
|
iconType: 'facebook',
|
||||||
link: 'http://facebook.com/',
|
link: 'http://facebook.com/',
|
||||||
image: 'http://facebook.com/icon.png',
|
image: 'http://facebook.com/icon.png',
|
||||||
text: 'Facebook icon',
|
text: 'Facebook icon'
|
||||||
},
|
}
|
||||||
],
|
]
|
||||||
});
|
});
|
||||||
view = new (SocialBlock.SocialBlockView)({model: model});
|
view = new (SocialBlock.SocialBlockView)({model: model});
|
||||||
view.render();
|
view.render();
|
||||||
@ -175,19 +175,19 @@ define([
|
|||||||
global.stubAvailableStyles(EditorApplication, {
|
global.stubAvailableStyles(EditorApplication, {
|
||||||
socialIconSets: {
|
socialIconSets: {
|
||||||
'default': {
|
'default': {
|
||||||
'custom': 'someimage.png',
|
'custom': 'someimage.png'
|
||||||
},
|
},
|
||||||
'light': {
|
'light': {
|
||||||
'custom': 'http://content.indiainfoline.com/wc/news/ImageGallery/css/close_32x32.png',
|
'custom': 'http://content.indiainfoline.com/wc/news/ImageGallery/css/close_32x32.png'
|
||||||
},
|
}
|
||||||
},
|
},
|
||||||
socialIcons: {
|
socialIcons: {
|
||||||
'custom': {
|
'custom': {
|
||||||
title: 'Custom',
|
title: 'Custom',
|
||||||
linkFieldName: 'Page URL',
|
linkFieldName: 'Page URL',
|
||||||
defaultLink: 'http://example.org',
|
defaultLink: 'http://example.org'
|
||||||
},
|
}
|
||||||
},
|
}
|
||||||
});
|
});
|
||||||
model = new (SocialBlock.SocialBlockModel)({
|
model = new (SocialBlock.SocialBlockModel)({
|
||||||
type: 'social',
|
type: 'social',
|
||||||
@ -200,9 +200,9 @@ define([
|
|||||||
image: 'someimage.png',
|
image: 'someimage.png',
|
||||||
height: '32px',
|
height: '32px',
|
||||||
width: '32px',
|
width: '32px',
|
||||||
text: 'some text',
|
text: 'some text'
|
||||||
}
|
}
|
||||||
],
|
]
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -218,19 +218,19 @@ define([
|
|||||||
global.stubAvailableStyles(EditorApplication, {
|
global.stubAvailableStyles(EditorApplication, {
|
||||||
socialIconSets: {
|
socialIconSets: {
|
||||||
'default': {
|
'default': {
|
||||||
'custom': 'http://www.sott.net/images/icons/big_x.png',
|
'custom': 'http://www.sott.net/images/icons/big_x.png'
|
||||||
},
|
},
|
||||||
'light': {
|
'light': {
|
||||||
'custom': 'http://content.indiainfoline.com/wc/news/ImageGallery/css/close_32x32.png',
|
'custom': 'http://content.indiainfoline.com/wc/news/ImageGallery/css/close_32x32.png'
|
||||||
},
|
}
|
||||||
},
|
},
|
||||||
socialIcons: {
|
socialIcons: {
|
||||||
'custom': {
|
'custom': {
|
||||||
title: 'Custom',
|
title: 'Custom',
|
||||||
linkFieldName: 'Page URL',
|
linkFieldName: 'Page URL',
|
||||||
defaultLink: 'http://example.org',
|
defaultLink: 'http://example.org'
|
||||||
},
|
}
|
||||||
},
|
}
|
||||||
});
|
});
|
||||||
model = new (SocialBlock.SocialBlockModel)({
|
model = new (SocialBlock.SocialBlockModel)({
|
||||||
type: 'social',
|
type: 'social',
|
||||||
@ -243,9 +243,9 @@ define([
|
|||||||
image: 'someimage.png',
|
image: 'someimage.png',
|
||||||
height: '32px',
|
height: '32px',
|
||||||
width: '32px',
|
width: '32px',
|
||||||
text: 'some text',
|
text: 'some text'
|
||||||
}
|
}
|
||||||
],
|
]
|
||||||
});
|
});
|
||||||
view = new (SocialBlock.SocialBlockSettingsView)({model: model});
|
view = new (SocialBlock.SocialBlockSettingsView)({model: model});
|
||||||
view.render();
|
view.render();
|
||||||
|
@ -10,7 +10,7 @@ define([
|
|||||||
beforeEach(function () {
|
beforeEach(function () {
|
||||||
global.stubChannel(EditorApplication);
|
global.stubChannel(EditorApplication);
|
||||||
global.stubConfig(EditorApplication, {
|
global.stubConfig(EditorApplication, {
|
||||||
blockDefaults: {},
|
blockDefaults: {}
|
||||||
});
|
});
|
||||||
global.stubAvailableStyles(EditorApplication);
|
global.stubAvailableStyles(EditorApplication);
|
||||||
model = new (SpacerBlock.SpacerBlockModel)();
|
model = new (SpacerBlock.SpacerBlockModel)();
|
||||||
@ -41,7 +41,7 @@ define([
|
|||||||
it("triggers autosave if any attribute changes", function () {
|
it("triggers autosave if any attribute changes", function () {
|
||||||
var mock = sinon.mock().exactly(2).withArgs('autoSave');
|
var mock = sinon.mock().exactly(2).withArgs('autoSave');
|
||||||
EditorApplication.getChannel = sinon.stub().returns({
|
EditorApplication.getChannel = sinon.stub().returns({
|
||||||
trigger: mock,
|
trigger: mock
|
||||||
});
|
});
|
||||||
|
|
||||||
model.set('styles.block.backgroundColor', '#000000');
|
model.set('styles.block.backgroundColor', '#000000');
|
||||||
@ -57,11 +57,11 @@ define([
|
|||||||
styles: {
|
styles: {
|
||||||
block: {
|
block: {
|
||||||
backgroundColor: '#567890',
|
backgroundColor: '#567890',
|
||||||
height: '19px',
|
height: '19px'
|
||||||
},
|
}
|
||||||
},
|
}
|
||||||
},
|
}
|
||||||
},
|
}
|
||||||
});
|
});
|
||||||
var model = new (SpacerBlock.SpacerBlockModel)();
|
var model = new (SpacerBlock.SpacerBlockModel)();
|
||||||
|
|
||||||
|
@ -24,9 +24,9 @@ define([
|
|||||||
global.stubConfig(EditorApplication, {
|
global.stubConfig(EditorApplication, {
|
||||||
blockDefaults: {
|
blockDefaults: {
|
||||||
text: {
|
text: {
|
||||||
text: 'some custom config text',
|
text: 'some custom config text'
|
||||||
},
|
}
|
||||||
},
|
}
|
||||||
});
|
});
|
||||||
var model = new (TextBlock.TextBlockModel)();
|
var model = new (TextBlock.TextBlockModel)();
|
||||||
|
|
||||||
|
@ -14,13 +14,13 @@ define([
|
|||||||
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']);
|
||||||
@ -33,13 +33,13 @@ define([
|
|||||||
module = CommunicationInjector({
|
module = CommunicationInjector({
|
||||||
"mailpoet": {
|
"mailpoet": {
|
||||||
Ajax: {
|
Ajax: {
|
||||||
post: mock,
|
post: mock
|
||||||
},
|
}
|
||||||
},
|
}
|
||||||
});
|
});
|
||||||
deferred.resolve({
|
deferred.resolve({
|
||||||
'post': 'val1',
|
'post': 'val1',
|
||||||
'page': 'val2',
|
'page': 'val2'
|
||||||
});
|
});
|
||||||
module.getPostTypes();
|
module.getPostTypes();
|
||||||
module.getPostTypes();
|
module.getPostTypes();
|
||||||
@ -55,7 +55,7 @@ define([
|
|||||||
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;
|
||||||
},
|
},
|
||||||
@ -64,9 +64,9 @@ define([
|
|||||||
module = CommunicationInjector({
|
module = CommunicationInjector({
|
||||||
"mailpoet": {
|
"mailpoet": {
|
||||||
Ajax: {
|
Ajax: {
|
||||||
post: spy,
|
post: spy
|
||||||
},
|
}
|
||||||
},
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
module.getTaxonomies('post');
|
module.getTaxonomies('post');
|
||||||
@ -86,8 +86,8 @@ define([
|
|||||||
});
|
});
|
||||||
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' });
|
||||||
@ -100,9 +100,9 @@ define([
|
|||||||
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');
|
||||||
@ -125,13 +125,13 @@ define([
|
|||||||
module = CommunicationInjector({
|
module = CommunicationInjector({
|
||||||
"mailpoet": {
|
"mailpoet": {
|
||||||
Ajax: {
|
Ajax: {
|
||||||
post: spy,
|
post: spy
|
||||||
},
|
}
|
||||||
},
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
module.getTerms({
|
module.getTerms({
|
||||||
taxonomies: ['category', 'post_tag'],
|
taxonomies: ['category', 'post_tag']
|
||||||
});
|
});
|
||||||
expect(spy.args[0][0].data.taxonomies).to.eql(['category', 'post_tag']);
|
expect(spy.args[0][0].data.taxonomies).to.eql(['category', 'post_tag']);
|
||||||
});
|
});
|
||||||
@ -150,8 +150,8 @@ define([
|
|||||||
});
|
});
|
||||||
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' });
|
||||||
@ -164,9 +164,9 @@ define([
|
|||||||
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'] });
|
||||||
@ -189,9 +189,9 @@ define([
|
|||||||
module = CommunicationInjector({
|
module = CommunicationInjector({
|
||||||
"mailpoet": {
|
"mailpoet": {
|
||||||
Ajax: {
|
Ajax: {
|
||||||
post: spy,
|
post: spy
|
||||||
},
|
}
|
||||||
},
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
module.getPosts({
|
module.getPosts({
|
||||||
@ -218,8 +218,8 @@ define([
|
|||||||
});
|
});
|
||||||
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'}]);
|
||||||
@ -232,9 +232,9 @@ define([
|
|||||||
module = CommunicationInjector({
|
module = CommunicationInjector({
|
||||||
"mailpoet": {
|
"mailpoet": {
|
||||||
Ajax: {
|
Ajax: {
|
||||||
post: mock,
|
post: mock
|
||||||
},
|
}
|
||||||
},
|
}
|
||||||
});
|
});
|
||||||
deferred.resolve({
|
deferred.resolve({
|
||||||
type: 'posts',
|
type: 'posts',
|
||||||
@ -260,9 +260,9 @@ define([
|
|||||||
module = CommunicationInjector({
|
module = CommunicationInjector({
|
||||||
"mailpoet": {
|
"mailpoet": {
|
||||||
Ajax: {
|
Ajax: {
|
||||||
post: spy,
|
post: spy
|
||||||
},
|
}
|
||||||
},
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
module.getTransformedPosts({
|
module.getTransformedPosts({
|
||||||
@ -271,7 +271,7 @@ define([
|
|||||||
});
|
});
|
||||||
expect(spy.args[0][0].data).to.eql({
|
expect(spy.args[0][0].data).to.eql({
|
||||||
type: 'posts',
|
type: 'posts',
|
||||||
posts: [1, 2],
|
posts: [1, 2]
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -289,8 +289,8 @@ define([
|
|||||||
});
|
});
|
||||||
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'}]);
|
||||||
@ -303,13 +303,13 @@ define([
|
|||||||
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]
|
||||||
});
|
});
|
||||||
module.getTransformedPosts({});
|
module.getTransformedPosts({});
|
||||||
module.getTransformedPosts({});
|
module.getTransformedPosts({});
|
||||||
|
@ -6,7 +6,7 @@ define([
|
|||||||
describe('Config', function () {
|
describe('Config', function () {
|
||||||
it('loads and stores configuration', function() {
|
it('loads and stores configuration', function() {
|
||||||
ConfigComponent.setConfig({
|
ConfigComponent.setConfig({
|
||||||
testConfig: 'testValue',
|
testConfig: 'testValue'
|
||||||
});
|
});
|
||||||
var model = ConfigComponent.getConfig();
|
var model = ConfigComponent.getConfig();
|
||||||
expect(model.get('testConfig')).to.equal('testValue');
|
expect(model.get('testConfig')).to.equal('testValue');
|
||||||
|
@ -12,12 +12,12 @@ define([
|
|||||||
body: {
|
body: {
|
||||||
globalStyles: {
|
globalStyles: {
|
||||||
style1: 'style1Value',
|
style1: 'style1Value',
|
||||||
style2: 'style2Value',
|
style2: 'style2Value'
|
||||||
},
|
},
|
||||||
content: {
|
content: {
|
||||||
data1: 'data1Value',
|
data1: 'data1Value',
|
||||||
data2: 'data2Value',
|
data2: 'data2Value'
|
||||||
},
|
}
|
||||||
},
|
},
|
||||||
subject: 'my test subject'
|
subject: 'my test subject'
|
||||||
});
|
});
|
||||||
@ -26,7 +26,7 @@ define([
|
|||||||
it('triggers autosave on change', function() {
|
it('triggers autosave on change', function() {
|
||||||
var mock = sinon.mock({ trigger: function() {} }).expects('trigger').once().withArgs('autoSave');
|
var mock = sinon.mock({ trigger: function() {} }).expects('trigger').once().withArgs('autoSave');
|
||||||
global.stubChannel(EditorApplication, {
|
global.stubChannel(EditorApplication, {
|
||||||
trigger: mock,
|
trigger: mock
|
||||||
});
|
});
|
||||||
model.set('subject', 'another test subject');
|
model.set('subject', 'another test subject');
|
||||||
mock.verify();
|
mock.verify();
|
||||||
@ -63,7 +63,7 @@ define([
|
|||||||
blockView = new Backbone.View();
|
blockView = new Backbone.View();
|
||||||
ContentComponent.registerBlockType('testType', {
|
ContentComponent.registerBlockType('testType', {
|
||||||
blockModel: blockModel,
|
blockModel: blockModel,
|
||||||
blockView: blockView,
|
blockView: blockView
|
||||||
});
|
});
|
||||||
expect(ContentComponent.getBlockTypeModel('testType')).to.deep.equal(blockModel);
|
expect(ContentComponent.getBlockTypeModel('testType')).to.deep.equal(blockModel);
|
||||||
expect(ContentComponent.getBlockTypeView('testType')).to.deep.equal(blockView);
|
expect(ContentComponent.getBlockTypeView('testType')).to.deep.equal(blockView);
|
||||||
@ -73,11 +73,11 @@ 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() {
|
||||||
@ -88,14 +88,14 @@ define([
|
|||||||
return {
|
return {
|
||||||
toJSON: function() {
|
toJSON: function() {
|
||||||
return stylesField;
|
return stylesField;
|
||||||
},
|
}
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
EditorApplication.getNewsletter = function() {
|
EditorApplication.getNewsletter = function() {
|
||||||
return {
|
return {
|
||||||
toJSON: function() {
|
toJSON: function() {
|
||||||
return newsletterFields;
|
return newsletterFields;
|
||||||
},
|
}
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
var json = ContentComponent.toJSON();
|
var json = ContentComponent.toJSON();
|
||||||
@ -103,7 +103,7 @@ define([
|
|||||||
body: {
|
body: {
|
||||||
content: dataField,
|
content: dataField,
|
||||||
globalStyles: stylesField
|
globalStyles: stylesField
|
||||||
},
|
}
|
||||||
}, newsletterFields));
|
}, newsletterFields));
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -8,10 +8,10 @@ define([
|
|||||||
var view;
|
var view;
|
||||||
beforeEach(function() {
|
beforeEach(function() {
|
||||||
var model = new Backbone.SuperModel({
|
var model = new Backbone.SuperModel({
|
||||||
subject: 'a test subject',
|
subject: 'a test subject'
|
||||||
});
|
});
|
||||||
view = new (HeadingComponent.HeadingView)({
|
view = new (HeadingComponent.HeadingView)({
|
||||||
model: model,
|
model: model
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -24,10 +24,10 @@ define([
|
|||||||
beforeEach(function() {
|
beforeEach(function() {
|
||||||
model = new Backbone.SuperModel({
|
model = new Backbone.SuperModel({
|
||||||
subject: 'a test subject',
|
subject: 'a test subject',
|
||||||
preheader: 'a test preheader',
|
preheader: 'a test preheader'
|
||||||
});
|
});
|
||||||
view = new (HeadingComponent.HeadingView)({
|
view = new (HeadingComponent.HeadingView)({
|
||||||
model: model,
|
model: model
|
||||||
});
|
});
|
||||||
view.render();
|
view.render();
|
||||||
});
|
});
|
||||||
|
@ -21,12 +21,12 @@ define([
|
|||||||
it('triggers beforeEditorSave event', function() {
|
it('triggers beforeEditorSave event', function() {
|
||||||
var spy = sinon.spy();
|
var spy = sinon.spy();
|
||||||
global.stubChannel(EditorApplication, {
|
global.stubChannel(EditorApplication, {
|
||||||
trigger: spy,
|
trigger: spy
|
||||||
});
|
});
|
||||||
EditorApplication.toJSON = sinon.stub().returns({
|
EditorApplication.toJSON = sinon.stub().returns({
|
||||||
body: {
|
body: {
|
||||||
type: 'container',
|
type: 'container'
|
||||||
},
|
}
|
||||||
});
|
});
|
||||||
module.save();
|
module.save();
|
||||||
expect(spy.withArgs('beforeEditorSave').calledOnce).to.be.true;
|
expect(spy.withArgs('beforeEditorSave').calledOnce).to.be.true;
|
||||||
@ -36,16 +36,16 @@ define([
|
|||||||
var spy = sinon.spy(),
|
var spy = sinon.spy(),
|
||||||
promise = jQuery.Deferred();
|
promise = jQuery.Deferred();
|
||||||
global.stubChannel(EditorApplication, {
|
global.stubChannel(EditorApplication, {
|
||||||
trigger: spy,
|
trigger: spy
|
||||||
});
|
});
|
||||||
EditorApplication.toJSON = sinon.stub().returns({
|
EditorApplication.toJSON = sinon.stub().returns({
|
||||||
body: {
|
body: {
|
||||||
type: 'container',
|
type: 'container'
|
||||||
},
|
}
|
||||||
});
|
});
|
||||||
var module = SaveInjector({
|
var module = SaveInjector({
|
||||||
'newsletter_editor/components/communication': {
|
'newsletter_editor/components/communication': {
|
||||||
saveNewsletter: sinon.stub().returns(promise),
|
saveNewsletter: sinon.stub().returns(promise)
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
promise.resolve({ success: true });
|
promise.resolve({ success: true });
|
||||||
@ -57,7 +57,7 @@ define([
|
|||||||
var mock = sinon.mock().once().returns(jQuery.Deferred());
|
var mock = sinon.mock().once().returns(jQuery.Deferred());
|
||||||
var module = SaveInjector({
|
var module = SaveInjector({
|
||||||
'newsletter_editor/components/communication': {
|
'newsletter_editor/components/communication': {
|
||||||
saveNewsletter: mock,
|
saveNewsletter: mock
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
global.stubChannel(EditorApplication);
|
global.stubChannel(EditorApplication);
|
||||||
@ -73,17 +73,17 @@ define([
|
|||||||
mock = sinon.mock()
|
mock = sinon.mock()
|
||||||
.once()
|
.once()
|
||||||
.withArgs({
|
.withArgs({
|
||||||
body: JSON.stringify(body),
|
body: JSON.stringify(body)
|
||||||
})
|
})
|
||||||
.returns(jQuery.Deferred());
|
.returns(jQuery.Deferred());
|
||||||
global.stubChannel(EditorApplication);
|
global.stubChannel(EditorApplication);
|
||||||
|
|
||||||
EditorApplication.toJSON = sinon.stub().returns({
|
EditorApplication.toJSON = sinon.stub().returns({
|
||||||
body: body,
|
body: body
|
||||||
});
|
});
|
||||||
var module = SaveInjector({
|
var module = SaveInjector({
|
||||||
'newsletter_editor/components/communication': {
|
'newsletter_editor/components/communication': {
|
||||||
saveNewsletter: mock,
|
saveNewsletter: mock
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
module.save();
|
module.save();
|
||||||
@ -125,7 +125,7 @@ define([
|
|||||||
it('triggers newsletter saving when clicked on save button', function() {
|
it('triggers newsletter saving when clicked on save button', function() {
|
||||||
var mock = sinon.mock({ trigger: function() {} }).expects('trigger').once().withArgs('save');
|
var mock = sinon.mock({ trigger: function() {} }).expects('trigger').once().withArgs('save');
|
||||||
global.stubChannel(EditorApplication, {
|
global.stubChannel(EditorApplication, {
|
||||||
trigger: mock,
|
trigger: mock
|
||||||
});
|
});
|
||||||
view.$('.mailpoet_save_button').click();
|
view.$('.mailpoet_save_button').click();
|
||||||
|
|
||||||
@ -142,29 +142,29 @@ define([
|
|||||||
html2canvasMock = jQuery.Deferred();
|
html2canvasMock = jQuery.Deferred();
|
||||||
|
|
||||||
html2canvasMock.resolve({
|
html2canvasMock.resolve({
|
||||||
toDataURL: function() { return 'somedataurl'; },
|
toDataURL: function() { return 'somedataurl'; }
|
||||||
});
|
});
|
||||||
|
|
||||||
EditorApplication.getBody = sinon.stub();
|
EditorApplication.getBody = sinon.stub();
|
||||||
var module = SaveInjector({
|
var module = SaveInjector({
|
||||||
'mailpoet': {
|
'mailpoet': {
|
||||||
Ajax: {
|
Ajax: {
|
||||||
post: mock,
|
post: mock
|
||||||
},
|
},
|
||||||
I18n: {
|
I18n: {
|
||||||
t: function() { return ''; },
|
t: function() { return ''; }
|
||||||
},
|
},
|
||||||
Notice: {
|
Notice: {
|
||||||
success: function() {},
|
success: function() {},
|
||||||
error: function() {},
|
error: function() {}
|
||||||
},
|
}
|
||||||
},
|
},
|
||||||
'newsletter_editor/App': EditorApplication,
|
'newsletter_editor/App': EditorApplication,
|
||||||
'html2canvas': function() {
|
'html2canvas': function() {
|
||||||
return {
|
return {
|
||||||
then: function() { return html2canvasMock; }
|
then: function() { return html2canvasMock; }
|
||||||
};
|
};
|
||||||
},
|
}
|
||||||
});
|
});
|
||||||
var view = new (module.SaveView)();
|
var view = new (module.SaveView)();
|
||||||
view.render();
|
view.render();
|
||||||
|
@ -8,7 +8,7 @@ define([
|
|||||||
var view;
|
var view;
|
||||||
beforeEach(function() {
|
beforeEach(function() {
|
||||||
view = new (SidebarComponent.SidebarWidgetsView)({
|
view = new (SidebarComponent.SidebarWidgetsView)({
|
||||||
collection: new Backbone.Collection([]),
|
collection: new Backbone.Collection([])
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -21,7 +21,7 @@ define([
|
|||||||
var view;
|
var view;
|
||||||
beforeEach(function() {
|
beforeEach(function() {
|
||||||
view = new (SidebarComponent.SidebarLayoutWidgetsView)({
|
view = new (SidebarComponent.SidebarLayoutWidgetsView)({
|
||||||
collection: new Backbone.Collection([]),
|
collection: new Backbone.Collection([])
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -35,7 +35,7 @@ define([
|
|||||||
beforeEach(function() {
|
beforeEach(function() {
|
||||||
view = new (SidebarComponent.SidebarStylesView)({
|
view = new (SidebarComponent.SidebarStylesView)({
|
||||||
model: new Backbone.SuperModel({}),
|
model: new Backbone.SuperModel({}),
|
||||||
availableStyles: new Backbone.SuperModel({}),
|
availableStyles: new Backbone.SuperModel({})
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -49,43 +49,43 @@ define([
|
|||||||
model = new Backbone.SuperModel({
|
model = new Backbone.SuperModel({
|
||||||
text: {
|
text: {
|
||||||
fontColor: '#000000',
|
fontColor: '#000000',
|
||||||
fontFamily: 'Arial',
|
fontFamily: 'Arial'
|
||||||
},
|
},
|
||||||
h1: {
|
h1: {
|
||||||
fontColor: '#000001',
|
fontColor: '#000001',
|
||||||
fontFamily: 'Arial',
|
fontFamily: 'Arial'
|
||||||
},
|
},
|
||||||
h2: {
|
h2: {
|
||||||
fontColor: '#000002',
|
fontColor: '#000002',
|
||||||
fontFamily: 'Arial',
|
fontFamily: 'Arial'
|
||||||
},
|
},
|
||||||
h3: {
|
h3: {
|
||||||
fontColor: '#000003',
|
fontColor: '#000003',
|
||||||
fontFamily: 'Arial',
|
fontFamily: 'Arial'
|
||||||
},
|
},
|
||||||
link: {
|
link: {
|
||||||
fontColor: '#000005',
|
fontColor: '#000005',
|
||||||
textDecoration: 'none',
|
textDecoration: 'none'
|
||||||
},
|
},
|
||||||
wrapper: {
|
wrapper: {
|
||||||
backgroundColor: '#090909',
|
backgroundColor: '#090909'
|
||||||
},
|
},
|
||||||
body: {
|
body: {
|
||||||
backgroundColor: '#020202',
|
backgroundColor: '#020202'
|
||||||
},
|
}
|
||||||
});
|
});
|
||||||
availableStyles = new Backbone.SuperModel({
|
availableStyles = new Backbone.SuperModel({
|
||||||
fonts: ['Arial', 'Times New Roman', 'Tahoma', 'Comic Sans', 'Lucida'],
|
fonts: ['Arial', 'Times New Roman', 'Tahoma', 'Comic Sans', 'Lucida'],
|
||||||
textSizes: [
|
textSizes: [
|
||||||
'9px', '10px',
|
'9px', '10px'
|
||||||
],
|
],
|
||||||
headingSizes: [
|
headingSizes: [
|
||||||
'10px', '12px', '14px', '16px', '18px',
|
'10px', '12px', '14px', '16px', '18px'
|
||||||
],
|
]
|
||||||
});
|
});
|
||||||
view = new (SidebarComponent.SidebarStylesView)({
|
view = new (SidebarComponent.SidebarStylesView)({
|
||||||
model: model,
|
model: model,
|
||||||
availableStyles: availableStyles,
|
availableStyles: availableStyles
|
||||||
});
|
});
|
||||||
|
|
||||||
view.render();
|
view.render();
|
||||||
|
@ -6,7 +6,7 @@ define([
|
|||||||
describe('Styles', function () {
|
describe('Styles', function () {
|
||||||
it('loads and stores globally available styles', function() {
|
it('loads and stores globally available styles', function() {
|
||||||
StylesComponent.setGlobalStyles({
|
StylesComponent.setGlobalStyles({
|
||||||
testStyle: 'testValue',
|
testStyle: 'testValue'
|
||||||
});
|
});
|
||||||
var model = StylesComponent.getGlobalStyles();
|
var model = StylesComponent.getGlobalStyles();
|
||||||
expect(model.get('testStyle')).to.equal('testValue');
|
expect(model.get('testStyle')).to.equal('testValue');
|
||||||
@ -22,7 +22,7 @@ define([
|
|||||||
var mock = sinon.mock({ trigger: function(){}}).expects('trigger').once().withExactArgs('autoSave');
|
var mock = sinon.mock({ trigger: function(){}}).expects('trigger').once().withExactArgs('autoSave');
|
||||||
EditorApplication.getChannel = function() {
|
EditorApplication.getChannel = function() {
|
||||||
return {
|
return {
|
||||||
trigger: mock,
|
trigger: mock
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
model.set('text.fontColor', '#123456');
|
model.set('text.fontColor', '#123456');
|
||||||
|
Reference in New Issue
Block a user