3 'modules/documentCanvas/classAttributes'
4 ], function(chai, classAttributes) {
18 var assert = chai.assert;
20 describe('Class attributes', function() {
21 it('class has own attribute', function() {
22 assert.ok(classAttributes.hasMetaAttr('klass.sub1.sub2', 'prop2', stubDict));
25 it('class has attributes from parent classes', function() {
26 assert.ok(classAttributes.hasMetaAttr('klass.sub1.sub2', 'prop', stubDict));
27 assert.ok(classAttributes.hasMetaAttr('klass.sub1.sub2', 'prop1', stubDict));
30 it('list of class meta attributes', function() {
31 var attrList = classAttributes.getMetaAttrsList('klass.sub1.sub2', stubDict);
33 assert.deepEqual(attrList.own, [{name: 'prop2', type: 'string'}]);
34 assert.deepEqual(attrList.inheritedFrom['klass.sub1'], [{name: 'prop1', type: 'string'}]);
35 assert.deepEqual(attrList.inheritedFrom.klass, [{name: 'prop', type: 'string'}]);
36 assert.deepEqual(attrList.all.sort(), [
37 {name: 'prop', type: 'string'},
38 {name: 'prop1', type: 'string'},
39 {name: 'prop2', type: 'string'}
40 ].sort(), 'all values');
43 it('class without meta attrs', function() {
44 var attrList = classAttributes.getMetaAttrsList('some.class', {});
45 assert.deepEqual(attrList.own, [], 'empty own list');
46 assert.deepEqual(attrList.inheritedFrom, {}, 'empty inherited dict');
47 assert.deepEqual(attrList.all, [], 'empty all list');
50 it('empty class', function() {
51 var attrList = classAttributes.getMetaAttrsList('', {});
52 assert.deepEqual(attrList.own, [], 'empty own list');
53 assert.deepEqual(attrList.inheritedFrom, {}, 'empty inherited dict');
54 assert.deepEqual(attrList.all, [], 'empty all list');