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/limits-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

46 خطوط
1.7 KiB
CoffeeScript
Vendored

require 'es6-shim'
vows = require 'vows'
assert = require 'assert'
chroma = require '../chroma'
vows
.describe('Some tests for chroma.limits()')
.addBatch
'simple continuous domain':
topic: -> chroma.limits [1,2,3,4,5], 'continuous'
'domain': (topic) -> assert.deepEqual topic, [1,5]
'continuous domain, negative values':
topic: -> chroma.limits [1,-2, -3,4,5], 'continuous'
'domain': (topic) -> assert.deepEqual topic, [-3,5]
'continuous domain, null values':
topic: -> chroma.limits [1, undefined, null, 4, 5], 'continuous'
'domain': (topic) -> assert.deepEqual topic, [1,5]
'equidistant domain':
topic: -> chroma.limits [0,10], 'equidistant', 5
'domain': (topic) -> assert.deepEqual topic, [0, 2, 4, 6, 8, 10]
'equidistant domain, NaN values':
topic: -> chroma.limits [0,9,3,6,3,5,undefined,Number.NaN,10], 'equidistant', 5
'domain': (topic) -> assert.deepEqual topic, [0, 2, 4, 6, 8, 10]
'logarithmic domain':
topic: -> chroma.limits [1,10000], 'log', 4
'domain': (topic) -> assert.deepEqual topic, [1, 10, 100, 1000, 10000]
'logarithmic domain - non-positive values':
topic: -> [-1,10000]
'domain': (topic) ->
assert.throws () ->
chroma.limits topic, 'log', 4
, 'Logarithmic scales are only possible for values > 0'
'quantiles domain':
topic: -> chroma.limits [1,2,3,4,5,10,20,100], 'quantiles', 2
'domain': (topic) -> assert.deepEqual topic, [1, 5, 100]
.export(module)