Skip to content

Commit 7f3b2bb

Browse files
author
Justin Van Dort
committed
PR-4286:
Updated broken test Used subarray instead of slice for typed array to support older browsers
1 parent 9cb8f87 commit 7f3b2bb

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

src/lib/index.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -660,12 +660,14 @@ lib.minExtend = function(obj1, obj2) {
660660
v = obj1[k];
661661
if(k.charAt(0) === '_' || typeof v === 'function') continue;
662662
else if(k === 'module') objOut[k] = v;
663-
else if(lib.isArrayOrTypedArray(v)) {
663+
else if(Array.isArray(v)) {
664664
if(k === 'colorscale') {
665665
objOut[k] = v.slice();
666666
} else {
667667
objOut[k] = v.slice(0, arrayLen);
668668
}
669+
} else if(lib.isTypedArray(v)) {
670+
objOut[k] = v.subarray(0, arrayLen);
669671
} else if(v && (typeof v === 'object')) objOut[k] = lib.minExtend(obj1[k], obj2[k]);
670672
else objOut[k] = v;
671673
}

test/jasmine/tests/scatter_test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1121,7 +1121,7 @@ describe('end-to-end scatter tests', function() {
11211121

11221122
var legendPts = d3.select('.legend').selectAll('.scatterpts');
11231123
expect(legendPts.size()).toBe(1, '# legend items');
1124-
expect(getColor(legendPts.node())).toBe('rgb(0, 0, 0)', 'legend pt color');
1124+
expect(getColor(legendPts.node())).toBe('rgb(0, 255, 0)', 'legend pt color');
11251125
expect(getMarkerSize(legendPts.node())).toBe(16, 'legend pt size');
11261126
})
11271127
.catch(failTest)

0 commit comments

Comments
 (0)