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(){ getName: function(){
if(!this.name){ if(!this.name){
var id = this.cid.replace(/\D/g,''), var id = this.cid.replace(/\D/g,''),
type = this.get('type'); type = this.get('type');
this.name = type.charAt(0).toUpperCase() + type.slice(1) + 'Box' + id; 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; return this.name;
}, },

1
src/style_manager/model/PropertyFactory.js

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

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

@ -31,13 +31,13 @@ define(['DomComponents/model/Component',
it('Has expected name', function() { it('Has expected name', function() {
this.obj.cid = 'c999'; this.obj.cid = 'c999';
this.obj.getName().should.equal('Box999'); this.obj.getName().should.equal('Box 999');
}); });
it('Has expected name 2', function() { it('Has expected name 2', function() {
this.obj.cid = 'c999'; this.obj.cid = 'c999';
this.obj.set('type','testType'); 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', property: 'transition-property',
type: 'select', type: 'select',
defaults: 'width', defaults: 'width',
list: [{ value: 'width'}, list: [{ value: 'all'},
{ value: 'width'},
{ value : 'height'}, { value : 'height'},
{ value : 'background-color'}, { value : 'background-color'},
{ value : 'transform'}, { value : 'transform'},

Loading…
Cancel
Save