Skip to content

Commit 0fafe14

Browse files
committed
add test case 🔒 dates in x/y/z column heatmaps
1 parent 4434fad commit 0fafe14

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

test/jasmine/tests/heatmap_test.js

+22
Original file line numberDiff line numberDiff line change
@@ -428,6 +428,28 @@ describe('heatmap calc', function() {
428428
expect(out._xcategories).toEqual(['a', 'b', 'c']);
429429
expect(out._ycategories).toEqual(['A', 'B', 'C']);
430430
});
431+
432+
it('should handle the date x/y/z/ column case', function() {
433+
var out = _calc({
434+
x: [
435+
'2016-01-01', '2016-01-01', '2016-01-01',
436+
'2017-01-01', '2017-01-01', '2017-01-01',
437+
'2017-06-01', '2017-06-01', '2017-06-01'
438+
],
439+
y: [0, 1, 2, 0, 1, 2, 0, 1, 2],
440+
z: [0, 50, 100, 50, 0, 255, 100, 510, 1010]
441+
});
442+
443+
expect(out.x).toBeCloseToArray([
444+
1435795200000, 1467417600000, 1489752000000, 1502798400000
445+
]);
446+
expect(out.y).toBeCloseToArray([-0.5, 0.5, 1.5, 2.5]);
447+
expect(out.z).toBeCloseTo2DArray([
448+
[0, 50, 100],
449+
[50, 0, 510],
450+
[100, 255, 1010]
451+
]);
452+
});
431453
});
432454

433455
describe('heatmap plot', function() {

0 commit comments

Comments
 (0)