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

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

@ -15,9 +15,11 @@ module.exports = {
describe('HtmlGenerator', () => {
beforeEach(() => {
em = new Editor();
obj = new HtmlGenerator();
dcomp = new DomComponents();
comp = new Component({}, {
em,
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 ComponentTextView = require('./view/ComponentTextView');
const ComponentImageView = require('./view/ComponentImageView');
const Editor = require('editor/model/Editor');
const utils = require('./../test_utils.js');
describe('DOM Components', () => {
describe('Main', () => {
var em;
var obj;
var config;
var storagMock = utils.storageMock();
@ -39,7 +41,9 @@ describe('DOM Components', () => {
beforeEach(() => {
em = new Editor();
config = {
em,
storeWrapper: 1,
};
obj = new DomComponents().init(config);

Loading…
Cancel
Save