Browse Source

Update getProperty tests

pull/2992/head
Artur Arseniev 6 years ago
parent
commit
60998c8fe4
  1. 4
      src/style_manager/index.js
  2. 6
      test/specs/style_manager/index.js

4
src/style_manager/index.js

@ -211,7 +211,7 @@ export default () => {
*/
getProperty(sectorId, name) {
const sector = this.getSector(sectorId, { warn: 1 });
let prop = null;
let prop;
if (sector) {
prop = sector
@ -221,7 +221,7 @@ export default () => {
)[0];
}
return prop;
return prop || null;
},
/**

6
test/specs/style_manager/index.js

@ -97,7 +97,7 @@ describe('StyleManager', () => {
test("Can't get properties without proper name", () => {
obj.addSector('test', {});
obj.addProperty('test', [{}, {}]);
expect(obj.getProperty('test', 'test-prop')).toEqual([]);
expect(obj.getProperty('test', 'test-prop')).toEqual(null);
});
test('Get property with proper name', () => {
@ -109,11 +109,11 @@ describe('StyleManager', () => {
test('Get properties with proper name', () => {
obj.addSector('test', {});
var prop1 = obj.addProperty('test', [
obj.addProperty('test', [
{ property: 'test-prop' },
{ property: 'test-prop' }
]);
expect(obj.getProperty('test', 'test-prop').length).toEqual(2);
expect(obj.getProperty('test', 'test-prop').length).toEqual(1);
});
test('Get inexistent properties', () => {

Loading…
Cancel
Save