Browse Source

Add PropertyView tests

pull/36/head
Artur Arseniev 10 years ago
parent
commit
8f9a826ccd
  1. 2
      src/style_manager/view/PropertyView.js
  2. 5
      test/specs/style_manager/main.js
  3. 47
      test/specs/style_manager/view/PropertyView.js
  4. 2
      test/specs/style_manager/view/SectorsView.js

2
src/style_manager/view/PropertyView.js

@ -13,7 +13,7 @@ define(['backbone', 'text!./../templates/propertyLabel.html'],
},
initialize: function(o) {
this.config = o.config;
this.config = o.config || {};
this.pfx = this.config.stylePrefix || '';
this.target = o.target || {};
this.propTarget = o.propTarget || {};

5
test/specs/style_manager/main.js

@ -5,12 +5,14 @@ define([
modulePath + '/model/Models',
modulePath + '/view/SectorView',
modulePath + '/view/SectorsView',
modulePath + '/view/PropertyView',
],
function(
StyleManager,
Models,
SectorView,
SectorsView
SectorsView,
PropertyView
) {
describe('StyleManager', function() {
@ -179,6 +181,7 @@ define([
Models.run();
SectorView.run();
SectorsView.run();
PropertyView.run();
});

47
test/specs/style_manager/view/PropertyView.js

@ -0,0 +1,47 @@
var path = 'StyleManager/view/';
define([path + 'PropertyView', 'StyleManager/model/Property'],
function(PropertyView, Property) {
return {
run : function(){
describe('PropertyView', function() {
var $fixtures;
var $fixture;
var model;
var view;
before(function () {
$fixtures = $("#fixtures");
$fixture = $('<div class="cssrule-fixture"></div>');
});
beforeEach(function () {
model = new Property();
view = new PropertyView({
model: model
});
$fixture.empty().appendTo($fixtures);
$fixture.html(view.render().el);
});
afterEach(function () {
//view.remove(); // strange errors ???
});
after(function () {
$fixture.remove();
});
it('Rendered correctly', function() {
var prop = view.el;
$fixture.get(0).querySelector('.property').should.be.ok;
prop.querySelector('.label').should.be.ok;
});
});
}
};
});

2
test/specs/style_manager/view/SectorsView.js

@ -35,7 +35,7 @@ define([path + 'SectorsView', 'StyleManager/model/Sectors'],
});
it("Collection is empty", function (){
view.$el.html().should.be.empty;
view.el.innerHTML.should.be.empty;
});
it("Add new sectors", function (){

Loading…
Cancel
Save