-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed #6196, dead clip path references.
- Loading branch information
1 parent
2fd714e
commit 6b993dd
Showing
4 changed files
with
68 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
resources: | ||
- https://code.jquery.com/qunit/qunit-2.0.1.js | ||
- https://code.jquery.com/qunit/qunit-2.0.1.css | ||
... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<script src="https://code.highcharts.com/highcharts.js"></script> | ||
|
||
<div id="qunit"></div> | ||
<div id="qunit-fixture"></div> | ||
|
||
|
||
<div id="container" style="width: 600px; margin: 0 auto;"></div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
QUnit.test('Verify that references to unused clip paths are removed after animation', | ||
function (assert) { | ||
var done = assert.async(2), | ||
// Get list of unique clip path references | ||
getClipPathSet = function (chart) { | ||
var clipPathList = []; | ||
Highcharts.each( | ||
chart.container.querySelectorAll('[clip-path]'), | ||
function (clipPath) { | ||
var p = clipPath.getAttribute('clip-path'); | ||
if (Highcharts.inArray(p, clipPathList) < 0) { | ||
clipPathList.push(p); | ||
} | ||
} | ||
); | ||
return clipPathList; | ||
}; | ||
|
||
Highcharts.chart('container', { | ||
chart: { | ||
events: { | ||
load: function () { | ||
assert.strictEqual(getClipPathSet(this).length, 2, | ||
'There are references to two different clipPaths'); | ||
done(); | ||
} | ||
} | ||
}, | ||
series: [{ | ||
data: [1, 2, 3, 4], | ||
animation: { | ||
duration: 1 | ||
}, | ||
events: { | ||
afterAnimate: function () { | ||
assert.strictEqual(getClipPathSet(this.chart).length, 1, | ||
'There are only references to one clipPath after animation'); | ||
done(); | ||
} | ||
} | ||
}] | ||
}); | ||
}); |