@ -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`);
}
@ -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');
@ -9,6 +9,7 @@ module.exports = {
var model;
var view;
var editorModel;
var em;
beforeEach(() => {
model = new Devices([]);
@ -389,7 +389,7 @@ module.exports = {
});
test('ComponentImage toHTML', () => {
obj = new ComponentImage();
obj = new ComponentImage({ src: '' });
expect(obj.toHTML()).toEqual('<img/>');
@ -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);