fix(supernova): expose all data properties for dimensions and measures (#4)

This commit is contained in:
Nguyen Lam
2019-02-12 08:31:16 +01:00
committed by Miralem Drek
parent de938e2484
commit dad12f0484
2 changed files with 14 additions and 0 deletions

View File

@@ -40,11 +40,16 @@ describe('qae', () => {
min: () => 3,
max: () => 7,
add: () => 'a',
description: () => 'Slice',
move: () => 'c',
replace: () => 'd',
},
measures: {
min: 2,
max: 4,
add: () => 'b',
description: () => 'Angle',
remove: () => 'e',
},
}],
},
@@ -53,8 +58,13 @@ describe('qae', () => {
expect(t.dimensions.min()).to.eql(3);
expect(t.dimensions.max()).to.eql(7);
expect(t.dimensions.add()).to.equal('a');
expect(t.dimensions.description()).to.equal('Slice');
expect(t.dimensions.move()).to.equal('c');
expect(t.dimensions.replace()).to.equal('d');
expect(t.measures.min()).to.eql(2);
expect(t.measures.max()).to.eql(4);
expect(t.measures.add()).to.equal('b');
expect(t.measures.description()).to.equal('Angle');
expect(t.measures.remove()).to.equal('e');
});
});

View File

@@ -12,6 +12,10 @@ function defFn(def = {}) {
min: typeof def.min === 'function' ? def.min : fallback(def.min, 0),
max: typeof def.max === 'function' ? def.max : fallback(def.max, 1000),
add: def.add || noop,
description: def.description || noop,
move: def.move || noop,
remove: def.remove || noop,
replace: def.replace || noop,
};
}