1
0
قرینه از https://github.com/matomo-org/matomo.git synced 2025-08-22 23:17:46 +00:00
Files
matomo/node_modules/chroma-js/test/interpolate-test.coffee
diosmosis b12946909f run npm update and include node_modules (#16079)
* update npm packages to latest

* fix javascript path location

* update screenshots

* Add node_modules for users that do not have npm insalled but use git to deploy.

* fix release checklist test

* Add old chroma-js + some files missing from node_module.

* remove npm install

* fix .travis.yml

* update expected screenshots

* update submodule

Co-authored-by: sgiehl <stefan@matomo.org>
2020-06-26 02:33:41 -07:00

44 خطوط
1.6 KiB
CoffeeScript
Vendored

require 'es6-shim'
vows = require 'vows'
assert = require 'assert'
chroma = require '../chroma'
vows
.describe('Some tests for chroma.color()')
.addBatch
'hsv interpolation white <-> red':
topic: chroma('white').interpolate(0.5, 'red', 'hsv')
'works': (topic) -> assert.deepEqual topic.hex(), '#ff8080'
'hsl interpolation white <-> red':
topic: chroma('white').interpolate(0.5, 'red', 'hsl')
'works': (topic) -> assert.deepEqual topic.hex(), '#ff8080'
'rgb interpolation white <-> red':
topic: chroma('white').interpolate(0.5, 'red', 'rgb')
'works': (topic) -> assert.deepEqual topic.hex(), '#ff7f7f'
'hsv interpolation red <-> white':
topic: chroma('red').interpolate(0.5, 'white', 'hsv')
'works': (topic) -> assert.deepEqual topic.hex(), '#ff8080'
'hsl interpolation red <-> white':
topic: chroma('red').interpolate(0.5, 'white', 'hsl')
'works': (topic) -> assert.deepEqual topic.hex(), '#ff8080'
'rgb interpolation red <-> white':
topic: chroma('red').interpolate(0.5, 'white', 'rgb')
'works': (topic) -> assert.deepEqual topic.hex(), '#ff7f7f'
'interpolation short function':
topic: () ->
(t) -> chroma.interpolate('#ff0000', '#ffffff', t, 'hsv').hex()
'starts at red': (topic) -> assert.equal topic(0), '#ff0000'
'goes over light red': (topic) -> assert.equal topic(0.5), '#ff8080'
'ends at white': (topic) -> assert.equal topic(1), '#ffffff'
.export(module)