Browse Source

Change component getName

pull/36/head
Artur Arseniev 10 years ago
parent
commit
63c4a72c47
  1. 9
      src/dom_components/model/Component.js
  2. 1
      src/style_manager/model/PropertyFactory.js
  3. 4
      test/specs/dom_components/model/Component.js
  4. 3
      test/specs/style_manager/model/Models.js

9
src/dom_components/model/Component.js

@ -99,9 +99,12 @@ define(['backbone','./Components', 'ClassManager/model/ClassTags'],
* */
getName: function(){
if(!this.name){
var id = this.cid.replace(/\D/g,''),
type = this.get('type');
this.name = type.charAt(0).toUpperCase() + type.slice(1) + 'Box' + id;
var id = this.cid.replace(/\D/g,''),
type = this.get('type');
var tag = this.get('tagName');
tag = tag == 'div' ? 'box' : tag;
tag = type ? type : tag;
this.name = tag.charAt(0).toUpperCase() + tag.slice(1) + ' ' + id;
}
return this.name;
},

1
src/style_manager/model/PropertyFactory.js

@ -363,6 +363,7 @@ define(['backbone'],
break;
case 'transition-property':
obj.list = [
{ value: 'all'},
{ value: 'width'},
{ value : 'height'},
{ value : 'background-color'},

4
test/specs/dom_components/model/Component.js

@ -31,13 +31,13 @@ define(['DomComponents/model/Component',
it('Has expected name', function() {
this.obj.cid = 'c999';
this.obj.getName().should.equal('Box999');
this.obj.getName().should.equal('Box 999');
});
it('Has expected name 2', function() {
this.obj.cid = 'c999';
this.obj.set('type','testType');
this.obj.getName().should.equal('TestTypeBox999');
this.obj.getName().should.equal('TestType 999');
});
});

3
test/specs/style_manager/model/Models.js

@ -686,7 +686,8 @@ define([path + 'Sector',
property: 'transition-property',
type: 'select',
defaults: 'width',
list: [{ value: 'width'},
list: [{ value: 'all'},
{ value: 'width'},
{ value : 'height'},
{ value : 'background-color'},
{ value : 'transform'},

Loading…
Cancel
Save