editor: Disable update blockDefaults for texts and images
This commit is contained in:
@ -31,7 +31,8 @@ define([
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, App.getConfig().get('blockDefaults.image'));
|
}, App.getConfig().get('blockDefaults.image'));
|
||||||
}
|
},
|
||||||
|
_updateDefaults: function () {}
|
||||||
});
|
});
|
||||||
|
|
||||||
Module.ImageBlockView = base.BlockView.extend({
|
Module.ImageBlockView = base.BlockView.extend({
|
||||||
|
@ -18,7 +18,8 @@ define([
|
|||||||
type: 'text',
|
type: 'text',
|
||||||
text: 'Edit this to insert text'
|
text: 'Edit this to insert text'
|
||||||
}, App.getConfig().get('blockDefaults.text'));
|
}, App.getConfig().get('blockDefaults.text'));
|
||||||
}
|
},
|
||||||
|
_updateDefaults: function updateDefaults() {}
|
||||||
});
|
});
|
||||||
|
|
||||||
Module.TextBlockView = base.BlockView.extend({
|
Module.TextBlockView = base.BlockView.extend({
|
||||||
|
@ -10,12 +10,17 @@ define([
|
|||||||
describe('Image', function () {
|
describe('Image', function () {
|
||||||
describe('model', function () {
|
describe('model', function () {
|
||||||
var model;
|
var model;
|
||||||
|
var sandbox;
|
||||||
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)();
|
||||||
|
sandbox = sinon.sandbox.create();
|
||||||
|
});
|
||||||
|
afterEach(function () {
|
||||||
|
sandbox.restore();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('has an image type', function () {
|
it('has an image type', function () {
|
||||||
@ -102,6 +107,12 @@ define([
|
|||||||
expect(innerModel.get('height')).to.equal('2345px');
|
expect(innerModel.get('height')).to.equal('2345px');
|
||||||
expect(innerModel.get('styles.block.textAlign')).to.equal('right');
|
expect(innerModel.get('styles.block.textAlign')).to.equal('right');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('do not update blockDefaults.image when changed', function () {
|
||||||
|
var stub = sandbox.stub(EditorApplication.getConfig(), 'set');
|
||||||
|
model.trigger('change');
|
||||||
|
expect(stub.callCount).to.equal(0);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('block view', function () {
|
describe('block view', function () {
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
const expect = global.expect;
|
const expect = global.expect;
|
||||||
|
const sinon = global.sinon;
|
||||||
|
|
||||||
define([
|
define([
|
||||||
'newsletter_editor/App',
|
'newsletter_editor/App',
|
||||||
@ -7,10 +8,16 @@ define([
|
|||||||
describe('Text', function () {
|
describe('Text', function () {
|
||||||
describe('model', function () {
|
describe('model', function () {
|
||||||
var model;
|
var model;
|
||||||
|
var sandbox;
|
||||||
beforeEach(function () {
|
beforeEach(function () {
|
||||||
global.stubChannel(EditorApplication);
|
global.stubChannel(EditorApplication);
|
||||||
global.stubConfig(EditorApplication);
|
global.stubConfig(EditorApplication);
|
||||||
model = new (TextBlock.TextBlockModel)();
|
model = new (TextBlock.TextBlockModel)();
|
||||||
|
sandbox = sinon.sandbox.create();
|
||||||
|
});
|
||||||
|
|
||||||
|
afterEach(function () {
|
||||||
|
sandbox.restore();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('has a text type', function () {
|
it('has a text type', function () {
|
||||||
@ -33,6 +40,12 @@ define([
|
|||||||
|
|
||||||
expect(model.get('text')).to.equal('some custom config text');
|
expect(model.get('text')).to.equal('some custom config text');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('do not update blockDefaults.text when changed', function () {
|
||||||
|
var stub = sandbox.stub(EditorApplication.getConfig(), 'set');
|
||||||
|
model.trigger('change');
|
||||||
|
expect(stub.callCount).to.equal(0);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('block view', function () {
|
describe('block view', function () {
|
||||||
|
Reference in New Issue
Block a user