custom value axis should not be overriden (#13639) (#13747)

This commit is contained in:
Peter Pisljar 2017-08-29 11:36:02 +02:00 committed by GitHub
parent 24c7fdf67f
commit fbd00dcced
2 changed files with 12 additions and 1 deletions

View file

@ -138,7 +138,7 @@ module.directive('vislibValueAxes', function () {
if (matchingSeries.length === 1) {
label = matchingSeries[0].makeLabel();
}
if (lastAxisTitles[axis.id] !== label) {
if (lastAxisTitles[axis.id] !== label && label !== '') {
lastAxisTitles[axis.id] = label;
axis.title.text = label;
}

View file

@ -104,4 +104,15 @@ describe('point series editor', function () {
$parentScope.removeValueAxis({ id: 'ValueAxis-1' });
expect($parentScope.vis.params.valueAxes.length).to.be(1);
});
it('should set the value axis title if its not set', function () {
$parentScope.updateAxisTitle();
expect($parentScope.vis.params.valueAxes[0].title.text).to.equal('Count');
});
it('should not update the value axis title if custom title was set', function () {
$parentScope.vis.params.valueAxes[0].title.text = 'Custom Title';
$parentScope.updateAxisTitle();
expect($parentScope.vis.params.valueAxes[0].title.text).to.equal('Custom Title');
});
});