Skip to content

Commit

Permalink
Fixed #10413, tweak addPoint function to returning point.
Browse files Browse the repository at this point in the history
  • Loading branch information
Sebastian Wedzel authored and TorsteinHonsi committed Apr 23, 2019
1 parent c1c9083 commit 860c744
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 0 deletions.
1 change: 1 addition & 0 deletions js/parts/Dynamics.js
Original file line number Diff line number Diff line change
Expand Up @@ -924,6 +924,7 @@ extend(Series.prototype, /** @lends Series.prototype */ {
if (redraw) {
chart.redraw(animation); // Animation is set anyway on redraw, #5665
}
return point;
},

/**
Expand Down
6 changes: 6 additions & 0 deletions samples/unit-tests/series/addpoint/demo.details
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
resources:
- https://code.jquery.com/qunit/qunit-2.0.1.js
- https://code.jquery.com/qunit/qunit-2.0.1.css
js_wrap: b
...
6 changes: 6 additions & 0 deletions samples/unit-tests/series/addpoint/demo.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<script src="https://code.highcharts.com/highcharts.js"></script>

<div id="qunit"></div>
<div id="qunit-fixture"></div>

<div id="container"></div>
15 changes: 15 additions & 0 deletions samples/unit-tests/series/addpoint/demo.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
QUnit.test('Testing addPoint() function - return point #10413', function (assert) {
var chart = Highcharts.chart('container', {
series: [{
data: [3, 4, 5]
}]
});

var point = chart.series[0].addPoint(8);

assert.strictEqual(
typeof (point),
'object',
'Point should be added to array as an object.'
);
});

0 comments on commit 860c744

Please sign in to comment.