Browse Source

Update radio view property tests

pull/187/head
Artur Arseniev 9 years ago
parent
commit
8c8a16f469
  1. 2
      test/specs/style_manager/index.js
  2. 47
      test/specs/style_manager/view/PropertyRadioView.js

2
test/specs/style_manager/index.js

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

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

@ -52,49 +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('Radio rendered', function() { it('Radio rendered', function() {
var prop = view.el; var prop = view.el;
prop.querySelector('input[type=radio]').should.be.ok; expect(prop.querySelector('input[type=radio]')).toExist();
}); });
it('Options rendered', function() { it('Options rendered', function() {
var input = view.el.querySelector('#input-holder'); var input = view.el.querySelector('#input-holder');
input.children.length.should.equal(options.length); expect(input.children.length).toEqual(options.length);
}); });
it('Options rendered correctly', function() { it('Options rendered correctly', function() {
var children = view.el.querySelector('#input-holder').children; var children = view.el.querySelector('#input-holder').children;
children[0].querySelector('label').textContent.should.equal('test1value'); expect(children[0].querySelector('label').textContent).toEqual('test1value');
children[1].querySelector('label').textContent.should.equal('test2'); expect(children[1].querySelector('label').textContent).toEqual('test2');
children[0].querySelector('input').value.should.equal(options[0].value); expect(children[0].querySelector('input').value).toEqual(options[0].value);
children[1].querySelector('input').value.should.equal(options[1].value); expect(children[1].querySelector('input').value).toEqual(options[1].value);
children[0].querySelector('label').getAttribute('title').should.equal(options[0].title); expect(children[0].querySelector('label').getAttribute('title')).toEqual(options[0].title);
(children[1].querySelector('label').getAttribute('title') == null) expect(children[1].querySelector('label').getAttribute('title')).toEqual(null);
.should.equal(true);
}); });
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.setValue(propValue); view.setValue(propValue);
view.model.get('value').should.equal(propValue); expect(view.model.get('value')).toEqual(propValue);
view.getInputValue().should.equal(propValue); expect(view.getInputValue()).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.getInputValue().should.equal(propValue); expect(view.getInputValue()).toEqual(propValue);
}); });
it('Update target on value change', function() { it('Update target on value change', function() {
@ -103,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() {
@ -123,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.getInputValue().should.equal(propValue); expect(view.getInputValue()).toEqual(propValue);
}); });
it('Update value after multiple swaps', function() { it('Update value after multiple swaps', function() {
@ -135,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.getInputValue().should.equal('test2value'); expect(view.getInputValue()).toEqual('test2value');
}); });
}) })
@ -159,11 +158,11 @@ 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('Input value is as default', function() { it('Input value is as default', function() {
view.getInputValue().should.equal(defValue); expect(view.getInputValue()).toEqual(defValue);
}); });
}); });

Loading…
Cancel
Save