From f2dc62905a135169315e4c954e738bbc0635d3c6 Mon Sep 17 00:00:00 2001 From: Artur Arseniev Date: Fri, 8 Mar 2019 08:01:08 +0100 Subject: [PATCH] Fix regressions --- src/device_manager/model/Device.js | 2 +- src/style_manager/model/Property.js | 4 ++-- test/specs/device_manager/view/DevicesView.js | 1 + test/specs/dom_components/model/Component.js | 2 +- test/specs/dom_components/view/ComponentImageView.js | 3 +-- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/device_manager/model/Device.js b/src/device_manager/model/Device.js index 13cb0dca5..66ae387e2 100644 --- a/src/device_manager/model/Device.js +++ b/src/device_manager/model/Device.js @@ -32,7 +32,7 @@ module.exports = Backbone.Model.extend({ }, checkUnit(prop) { - const pr = this.get(prop); + const pr = this.get(prop) || ''; const noUnit = (parseFloat(pr) || 0).toString() === pr.toString(); noUnit && this.set(prop, `${pr}px`); } diff --git a/src/style_manager/model/Property.js b/src/style_manager/model/Property.js index b0f4c40f1..cf2a4158e 100644 --- a/src/style_manager/model/Property.js +++ b/src/style_manager/model/Property.js @@ -43,8 +43,8 @@ const Property = require('backbone').Model.extend( }, initialize(props = {}, opts = {}) { - const id = this.get('id'); - const name = this.get('name'); + const id = this.get('id') || ''; + const name = this.get('name') || ''; !this.get('property') && this.set('property', (name || id).replace(/ /g, '-')); const prop = this.get('property'); diff --git a/test/specs/device_manager/view/DevicesView.js b/test/specs/device_manager/view/DevicesView.js index a691a90d1..3b894ee6d 100644 --- a/test/specs/device_manager/view/DevicesView.js +++ b/test/specs/device_manager/view/DevicesView.js @@ -9,6 +9,7 @@ module.exports = { var model; var view; var editorModel; + var em; beforeEach(() => { model = new Devices([]); diff --git a/test/specs/dom_components/model/Component.js b/test/specs/dom_components/model/Component.js index 1483ef842..3b242c373 100644 --- a/test/specs/dom_components/model/Component.js +++ b/test/specs/dom_components/model/Component.js @@ -389,7 +389,7 @@ module.exports = { }); test('ComponentImage toHTML', () => { - obj = new ComponentImage(); + obj = new ComponentImage({ src: '' }); expect(obj.toHTML()).toEqual(''); }); diff --git a/test/specs/dom_components/view/ComponentImageView.js b/test/specs/dom_components/view/ComponentImageView.js index 5bc402dd2..3df757060 100644 --- a/test/specs/dom_components/view/ComponentImageView.js +++ b/test/specs/dom_components/view/ComponentImageView.js @@ -1,5 +1,5 @@ const ComponentImageView = require('dom_components/view/ComponentImageView'); -const Component = require('dom_components/model/Component'); +const Component = require('dom_components/model/ComponentImage'); module.exports = { run() { @@ -21,7 +21,6 @@ module.exports = { }); test('Component empty', () => { - expect(view.el.getAttribute('onmousedown')).toEqual('return false'); expect(view.el.getAttribute('class')).toEqual(view.classEmpty); });