Skip to content

Commit 9dd98d9

Browse files
committed
Add test for colorscale cmin/cmax bounds
1 parent caea2aa commit 9dd98d9

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

test/jasmine/tests/colorscale_test.js

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -370,4 +370,28 @@ describe('Test colorscale:', function() {
370370
});
371371

372372
});
373+
374+
describe('makeScaleFunction', function() {
375+
var scale = [
376+
[0,'rgb(5,10,172)'],
377+
[0.35,'rgb(106,137,247)'],
378+
[0.5,'rgb(190,190,190)'],
379+
[0.6,'rgb(220,170,132)'],
380+
[0.7,'rgb(230,145,90)'],
381+
[1,'rgb(178,10,28)']
382+
],
383+
scaleFunction = Colorscale.makeScaleFunction(scale, 2, 3);
384+
385+
it('should constrain color array values between cmin and cmax', function() {
386+
var color1 = scaleFunction(1),
387+
color2 = scaleFunction(2),
388+
color3 = scaleFunction(3),
389+
color4 = scaleFunction(4);
390+
391+
expect(color1).toEqual(color2);
392+
expect(color1).toEqual('#050aac');
393+
expect(color3).toEqual(color4);
394+
expect(color4).toEqual('#b20a1c');
395+
});
396+
});
373397
});

0 commit comments

Comments
 (0)