diff options
Diffstat (limited to 'node_modules/chroma-js/test/contrast-test.coffee')
-rw-r--r-- | node_modules/chroma-js/test/contrast-test.coffee | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/node_modules/chroma-js/test/contrast-test.coffee b/node_modules/chroma-js/test/contrast-test.coffee new file mode 100644 index 0000000000..9897ea0bcd --- /dev/null +++ b/node_modules/chroma-js/test/contrast-test.coffee @@ -0,0 +1,24 @@ +require 'es6-shim' +vows = require 'vows' +assert = require 'assert' +chroma = require '../chroma' + + +vows + .describe('Testing contrast ratio') + + .addBatch + + 'maximum contrast': + topic: -> chroma.contrast 'black', 'white' + 'is 21:1': (topic) -> assert.equal topic, 21 + + 'minimum contrast': + topic: -> chroma.contrast 'white', 'white' + 'is 1:1': (topic) -> assert.equal topic, 1 + + 'contrast between white and red': + topic: -> chroma.contrast 'red', 'white' + 'is 4:1': (topic) -> assert.equal Math.round(topic,5), 4 + + .export(module)
\ No newline at end of file |