Browse Source

Fix regressions

pull/540/head
Artur Arseniev 9 years ago
parent
commit
b4f36a6079
  1. 8
      src/dom_components/model/Component.js
  2. 2
      test/specs/code_manager/model/CodeModels.js
  3. 4
      test/specs/dom_components/index.js

8
src/dom_components/model/Component.js

@ -121,7 +121,7 @@ module.exports = Backbone.Model.extend(Styleable).extend({
initialize(props = {}, opt = {}) { initialize(props = {}, opt = {}) {
const em = opt.sm || opt.em || {}; const em = opt.sm || opt.em || '';
// Propagate properties from parent if indicated // Propagate properties from parent if indicated
const parent = this.parent(); const parent = this.parent();
@ -189,7 +189,7 @@ module.exports = Backbone.Model.extend(Styleable).extend({
getStyle() { getStyle() {
const em = this.em; const em = this.em;
if (em.getConfig('avoidInlineStyle')) { if (em && em.getConfig('avoidInlineStyle')) {
const state = this.get('state'); const state = this.get('state');
const cc = em.get('CssComposer'); const cc = em.get('CssComposer');
const rule = cc.getIdRule(this.getId(), { state }); const rule = cc.getIdRule(this.getId(), { state });
@ -207,7 +207,7 @@ module.exports = Backbone.Model.extend(Styleable).extend({
setStyle(prop = {}, opts = {}) { setStyle(prop = {}, opts = {}) {
const em = this.em; const em = this.em;
if (em.getConfig('avoidInlineStyle')) { if (em && em.getConfig('avoidInlineStyle')) {
prop = Styleable.setStyle.call(this, prop, {silent: 1, avoidStore: 1}); prop = Styleable.setStyle.call(this, prop, {silent: 1, avoidStore: 1});
const state = this.get('state'); const state = this.get('state');
const cc = em.get('CssComposer'); const cc = em.get('CssComposer');
@ -501,7 +501,7 @@ module.exports = Backbone.Model.extend(Styleable).extend({
this.opt.collection = null; this.opt.collection = null;
} }
if (em.getConfig('avoidInlineStyle') && !isEmpty(style)) { if (em && em.getConfig('avoidInlineStyle') && !isEmpty(style)) {
attr.style = style; attr.style = style;
} }

2
test/specs/code_manager/model/CodeModels.js

@ -15,9 +15,11 @@ module.exports = {
describe('HtmlGenerator', () => { describe('HtmlGenerator', () => {
beforeEach(() => { beforeEach(() => {
em = new Editor();
obj = new HtmlGenerator(); obj = new HtmlGenerator();
dcomp = new DomComponents(); dcomp = new DomComponents();
comp = new Component({}, { comp = new Component({}, {
em,
componentTypes: dcomp.componentTypes, componentTypes: dcomp.componentTypes,
}); });
}); });

4
test/specs/dom_components/index.js

@ -5,12 +5,14 @@ const ComponentView = require('./view/ComponentV');
const ComponentsView = require('./view/ComponentsView'); const ComponentsView = require('./view/ComponentsView');
const ComponentTextView = require('./view/ComponentTextView'); const ComponentTextView = require('./view/ComponentTextView');
const ComponentImageView = require('./view/ComponentImageView'); const ComponentImageView = require('./view/ComponentImageView');
const Editor = require('editor/model/Editor');
const utils = require('./../test_utils.js'); const utils = require('./../test_utils.js');
describe('DOM Components', () => { describe('DOM Components', () => {
describe('Main', () => { describe('Main', () => {
var em;
var obj; var obj;
var config; var config;
var storagMock = utils.storageMock(); var storagMock = utils.storageMock();
@ -39,7 +41,9 @@ describe('DOM Components', () => {
beforeEach(() => { beforeEach(() => {
em = new Editor();
config = { config = {
em,
storeWrapper: 1, storeWrapper: 1,
}; };
obj = new DomComponents().init(config); obj = new DomComponents().init(config);

Loading…
Cancel
Save