We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent caea2aa commit 9dd98d9Copy full SHA for 9dd98d9
test/jasmine/tests/colorscale_test.js
@@ -370,4 +370,28 @@ describe('Test colorscale:', function() {
370
});
371
372
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
397
0 commit comments