Browse Source

Update property select view tests

pull/187/head
Artur Arseniev 9 years ago
parent
commit
11bfb40b52
  1. 2
      test/specs/style_manager/index.js
  2. 46
      test/specs/style_manager/view/PropertySelectView.js

2
test/specs/style_manager/index.js

@ -182,8 +182,8 @@ describe.only('StyleManager', function() {
SectorView.run(); SectorView.run();
SectorsView.run(); SectorsView.run();
PropertyView.run(); PropertyView.run();
/*
PropertySelectView.run(); PropertySelectView.run();
/*
PropertyRadioView.run(); PropertyRadioView.run();
PropertyIntegerView.run(); PropertyIntegerView.run();
PropertyColorView.run(); PropertyColorView.run();

46
test/specs/style_manager/view/PropertySelectView.js

@ -52,48 +52,48 @@ module.exports = {
it('Rendered correctly', function() { it('Rendered correctly', function() {
var prop = view.el; var prop = view.el;
$fixture.get(0).querySelector('.property').should.be.ok; expect($fixture.get(0).querySelector('.property')).toExist();
prop.querySelector('.label').should.be.ok; expect(prop.querySelector('.label')).toExist();
prop.querySelector('.field').should.be.ok; expect(prop.querySelector('.field')).toExist();
}); });
it('Select rendered', function() { it('Select rendered', function() {
var prop = view.el; var prop = view.el;
prop.querySelector('select').should.be.ok; expect(prop.querySelector('select')).toExist();
}); });
it('Options rendered', function() { it('Options rendered', function() {
var select = view.el.querySelector('select'); var select = view.el.querySelector('select');
select.children.length.should.equal(options.length); expect(select.children.length).toEqual(options.length);
}); });
it('Options rendered correctly', function() { it('Options rendered correctly', function() {
var select = view.el.querySelector('select'); var select = view.el.querySelector('select');
var children = select.children; var children = select.children;
children[0].value.should.equal(options[0].value); expect(children[0].value).toEqual(options[0].value);
children[1].value.should.equal(options[1].value); expect(children[1].value).toEqual(options[1].value);
children[0].textContent.should.equal(options[0].value); expect(children[0].textContent).toEqual(options[0].value);
children[1].textContent.should.equal(options[1].name); expect(children[1].textContent).toEqual(options[1].name);
children[0].getAttribute('style').should.equal(options[0].style); expect(children[0].getAttribute('style')).toEqual(options[0].style);
(children[1].getAttribute('style') == null).should.equal(true); expect(children[1].getAttribute('style')).toEqual(null);
}); });
it('Input should exist', function() { it('Input should exist', function() {
view.$input.should.be.ok; expect(view.$input).toExist();
}); });
it('Input value is empty', function() { it('Input value is empty', function() {
view.model.get('value').should.be.empty; expect(view.model.get('value')).toNotExist();
}); });
it('Update model on input change', function() { it('Update model on input change', function() {
view.$input.val(propValue).trigger('change'); view.$input.val(propValue).trigger('change');
view.model.get('value').should.equal(propValue); expect(view.model.get('value')).toEqual(propValue);
}); });
it('Update input on value change', function() { it('Update input on value change', function() {
view.model.set('value', propValue); view.model.set('value', propValue);
view.$input.val().should.equal(propValue); expect(view.$input.val()).toEqual(propValue);
}); });
it('Update target on value change', function() { it('Update target on value change', function() {
@ -102,7 +102,7 @@ module.exports = {
var compStyle = view.selectedComponent.get('style'); var compStyle = view.selectedComponent.get('style');
var assertStyle = {}; var assertStyle = {};
assertStyle[propName] = propValue; assertStyle[propName] = propValue;
compStyle.should.deep.equal(assertStyle); expect(compStyle).toEqual(assertStyle);
}); });
describe('With target setted', function() { describe('With target setted', function() {
@ -122,8 +122,8 @@ module.exports = {
style[propName] = propValue; style[propName] = propValue;
component.set('style', style); component.set('style', style);
view.propTarget.trigger('update'); view.propTarget.trigger('update');
view.model.get('value').should.equal(propValue); expect(view.model.get('value')).toEqual(propValue);
view.$input.val().should.equal(propValue); expect(view.$input.val()).toEqual(propValue);
}); });
it('Update value after multiple swaps', function() { it('Update value after multiple swaps', function() {
@ -134,8 +134,8 @@ module.exports = {
style[propName] = 'test2value'; style[propName] = 'test2value';
component.set('style', style); component.set('style', style);
view.propTarget.trigger('update'); view.propTarget.trigger('update');
view.model.get('value').should.equal('test2value'); expect(view.model.get('value')).toEqual('test2value');
view.$input.val().should.equal('test2value'); expect(view.$input.val()).toEqual('test2value');
}); });
}) })
@ -158,7 +158,7 @@ module.exports = {
}); });
it('Value as default', function() { it('Value as default', function() {
view.model.get('value').should.equal(defValue); expect(view.model.get('value')).toEqual(defValue);
}); });
it('Empty value as default', function() { it('Empty value as default', function() {
@ -178,11 +178,11 @@ module.exports = {
model: model model: model
}); });
$fixture.html(view.render().el); $fixture.html(view.render().el);
view.$input.val().should.equal(''); expect(view.$input.val()).toEqual('');
}); });
it('Input value is as default', function() { it('Input value is as default', function() {
view.$input.val().should.equal(defValue); expect(view.$input.val()).toEqual(defValue);
}); });
}); });

Loading…
Cancel
Save