Skip to content

Commit

Permalink
Adding unit tests for sigma.utils.floatColor
Browse files Browse the repository at this point in the history
  • Loading branch information
Yomguithereal committed Feb 11, 2016
1 parent 1ba13d8 commit 99617dc
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
1 change: 1 addition & 0 deletions test/unit.html
Expand Up @@ -46,6 +46,7 @@
<script src="unit.quad.js"></script>
<script src="unit.edgequad.js"></script>
<script src="unit.animation.js"></script>
<script src="unit.utils.js"></script>
<script src="unit.core.js"></script>
<script src="unit.plugins.filter.js"></script>
<script src="unit.HITS.js"></script>
Expand Down
26 changes: 26 additions & 0 deletions test/unit.utils.js
@@ -0,0 +1,26 @@
module('sigma.utils');
test('Float color', function() {
var floatColor = sigma.utils.floatColor;

var inputs = [
'#FF0',
'#D1D1D1',
'#d1d1d1',
'rgb(234, 245, 298)',
'rgba(234, 245, 298, 0.1)',
'rgba(234, 245, 298, .1)'
];

var outputs = [
16776960,
13750737,
13750737,
15398442,
15398442,
15398442
];

inputs.forEach(function(input, i) {
strictEqual(floatColor(input), outputs[i]);
});
});

0 comments on commit 99617dc

Please sign in to comment.