From 45b7e3beeb22bbda51210645c2e58e4e0ca42cdc Mon Sep 17 00:00:00 2001 From: Artur Arseniev Date: Thu, 4 Aug 2016 23:11:30 +0200 Subject: [PATCH] Fix tests --- src/block_manager/view/BlocksView.js | 10 ++++++---- src/device_manager/view/DevicesView.js | 7 ++++--- test/specs/dom_components/view/ComponentImageView.js | 3 ++- 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/src/block_manager/view/BlocksView.js b/src/block_manager/view/BlocksView.js index 52a3d432c..b979833ec 100644 --- a/src/block_manager/view/BlocksView.js +++ b/src/block_manager/view/BlocksView.js @@ -10,10 +10,12 @@ function(Backbone, BlockView) { this.listenTo(this.collection, 'add', this.addTo); this.em = this.config.em; this.tac = 'test-tac'; - this.config.getSorter = this.getSorter; - this.config.dragHelper = this.dragHelper; - //this.listenTo(this.em, 'change:device', this.updateOffset); - this.canvas = this.em.get('Canvas'); + + if(this.em){ + this.config.getSorter = this.getSorter; + this.config.dragHelper = this.dragHelper; + this.canvas = this.em.get('Canvas'); + } }, /** diff --git a/src/device_manager/view/DevicesView.js b/src/device_manager/view/DevicesView.js index 51fd7da6a..a94de8d96 100644 --- a/src/device_manager/view/DevicesView.js +++ b/src/device_manager/view/DevicesView.js @@ -43,10 +43,11 @@ function(Backbone, devicesTemplate) { */ updateSelect: function(){ var em = this.em; - if(em){ - var device = this.em.getDeviceModel(); + var devEl = this.devicesEl; + if(em && em.getDeviceModel && devEl){ + var device = em.getDeviceModel(); var name = device ? device.get('name') : ''; - this.devicesEl.val(name); + devEl.val(name); } }, diff --git a/test/specs/dom_components/view/ComponentImageView.js b/test/specs/dom_components/view/ComponentImageView.js index dd5324bb2..ca9d5be7e 100644 --- a/test/specs/dom_components/view/ComponentImageView.js +++ b/test/specs/dom_components/view/ComponentImageView.js @@ -35,7 +35,8 @@ define([path + 'ComponentImageView', 'DomComponents/model/Component'], }); it('Component empty', function() { - $fixture.html().should.equal(''); + view.el.getAttribute('onmousedown').should.equal('return false'); + view.el.getAttribute('class').should.equal(view.classEmpty); }); it('TagName is ', function() {