Skip to content

Commit

Permalink
Fixed #6401, point.states didn't work for maps.
Browse files Browse the repository at this point in the history
  • Loading branch information
pawelfus committed Feb 23, 2017
1 parent affec87 commit 545f87d
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 3 deletions.
3 changes: 2 additions & 1 deletion js/parts/ColumnSeries.js
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,8 @@ seriesType('column', 'line', {

// Select or hover states
if (state) {
stateOptions = options.states[state];
stateOptions = point.options.states && point.options.states[state] || // #6401
options.states[state];
brightness = stateOptions.brightness;
fill = stateOptions.color ||
(brightness !== undefined && color(fill).brighten(stateOptions.brightness).get()) ||
Expand Down
40 changes: 40 additions & 0 deletions samples/unit-tests/point/point/demo.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,4 +112,44 @@ $(function () {
'One occurrence of class name'
);
});

QUnit.test('Point with state options (#6401)',
function (assert) {
var color = 'red',
chart = Highcharts.chart('container', {
chart: {
type: 'column'
},
plotOptions: {
column: {
states: {
hover: {
color: 'blue'
}
}
}
},
series: [{
data: [{
y: 20,
states: {
hover: {
color: color
}
}
}]
}]
});

chart.series[0].points[0].setState('hover');

assert.strictEqual(
Highcharts.attr(
chart.series[0].points[0].graphic.element,
'fill'
),
color,
'Correct fill color on hover'
);
});
});
3 changes: 2 additions & 1 deletion samples/unit-tests/series-heatmap/members/demo.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ QUnit.test('seriesTypes.heatmap.pointClass.setState', function (assert) {
},
pointAttribs: pointAttribs,
zones: []
}
},
options: {}
};
setState.call(point, '');
assert.strictEqual(
Expand Down
3 changes: 2 additions & 1 deletion samples/unit-tests/series-map/members/demo.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ QUnit.test('seriesTypes.map.pointClass.setState', function (assert) {
},
pointAttribs: pointAttribs,
zones: []
}
},
options: {}
};
setState.call(point, '');
assert.strictEqual(
Expand Down

0 comments on commit 545f87d

Please sign in to comment.