Skip to content

Commit

Permalink
Fixed strict tests
Browse files Browse the repository at this point in the history
  • Loading branch information
elusivecodes committed Oct 17, 2020
1 parent fbbfa35 commit cbd631c
Show file tree
Hide file tree
Showing 19 changed files with 237 additions and 237 deletions.
2 changes: 1 addition & 1 deletion dist/frost-color.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* FrostColor v2.0.1
* FrostColor v2.0.2
* https://github.com/elusivecodes/FrostColor
*/
(function(global, factory) {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "frostcolor",
"version": "2.0.1",
"version": "2.0.2",
"description": "FrostColor is a free, open-source color manipulation library for JavaScript.",
"keywords": [
"color",
Expand Down
2 changes: 1 addition & 1 deletion src/wrapper.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* FrostColor v2.0.1
* FrostColor v2.0.2
* https://github.com/elusivecodes/FrostColor
*/
(function(global, factory) {
Expand Down
28 changes: 14 additions & 14 deletions test/Color/attributes.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
const assert = require('assert').strict;
const assert = require('assert');
const { Color } = require('../../dist/frost-color.min');

describe('Color Attributes', function() {

describe('#getAlpha', function() {
it('returns the alpha value', function() {
assert.equal(
assert.strictEqual(
new Color(0, 0, 0, .75)
.getAlpha(),
.75
Expand All @@ -15,7 +15,7 @@ describe('Color Attributes', function() {

describe('#getBrightness', function() {
it('returns the brightness value', function() {
assert.equal(
assert.strictEqual(
Color.fromHSV(180, 50, 75)
.getBrightness(),
75
Expand All @@ -25,7 +25,7 @@ describe('Color Attributes', function() {

describe('#getHue', function() {
it('returns the hue value', function() {
assert.equal(
assert.strictEqual(
Color.fromHSV(270, 50, 50)
.getHue(),
270
Expand All @@ -35,7 +35,7 @@ describe('Color Attributes', function() {

describe('#getSaturation', function() {
it('returns the saturation value', function() {
assert.equal(
assert.strictEqual(
Color.fromHSV(180, 25, 50)
.getSaturation(),
25
Expand All @@ -45,7 +45,7 @@ describe('Color Attributes', function() {

describe('#luma', function() {
it('returns the luma value', function() {
assert.equal(
assert.strictEqual(
Color.fromHSV(180, 50, 50)
.luma(),
0.44684999999999997
Expand All @@ -57,11 +57,11 @@ describe('Color Attributes', function() {
it('sets the alpha value', function() {
const color1 = Color.fromHSV(120, 50, 50);
const color2 = color1.setAlpha(.75);
assert.equal(
assert.strictEqual(
color1.getAlpha(),
.75
);
assert.equal(
assert.strictEqual(
color1,
color2
);
Expand All @@ -72,11 +72,11 @@ describe('Color Attributes', function() {
it('sets the brightness value', function() {
const color1 = Color.fromHSV(180, 50, 50);
const color2 = color1.setBrightness(75);
assert.equal(
assert.strictEqual(
color1.getBrightness(),
75
);
assert.equal(
assert.strictEqual(
color1,
color2
);
Expand All @@ -87,11 +87,11 @@ describe('Color Attributes', function() {
it('sets the hue value', function() {
const color1 = Color.fromHSV(180, 50, 50);
const color2 = color1.setHue(270);
assert.equal(
assert.strictEqual(
color1.getHue(),
270
);
assert.equal(
assert.strictEqual(
color1,
color2
);
Expand All @@ -102,11 +102,11 @@ describe('Color Attributes', function() {
it('sets the saturation value', function() {
const color1 = Color.fromHSV(180, 50, 50);
const color2 = color1.setSaturation(25);
assert.equal(
assert.strictEqual(
color1.getSaturation(),
25
);
assert.equal(
assert.strictEqual(
color1,
color2
);
Expand Down
50 changes: 25 additions & 25 deletions test/Color/create.js
Original file line number Diff line number Diff line change
@@ -1,51 +1,51 @@
const assert = require('assert').strict;
const { Color, ColorImmutable } = require('../../dist/frost-color.min');
const assert = require('assert');
const { Color } = require('../../dist/frost-color.min');

describe('Color Creation', function() {

describe('#constructor', function() {
it('works with red argument', function() {
assert.equal(
assert.strictEqual(
new Color(255, 0, 0)
.toString(),
'red'
);
});

it('works with green argument', function() {
assert.equal(
assert.strictEqual(
new Color(0, 255, 0)
.toString(),
'lime'
);
});

it('works with blue argument', function() {
assert.equal(
assert.strictEqual(
new Color(0, 0, 255)
.toString(),
'blue'
);
});

it('works with alpha argument', function() {
assert.equal(
assert.strictEqual(
new Color(255, 255, 255, 0.5)
.toString(),
'rgba(255, 255, 255, 0.5)'
);
});

it('works with brightness argument', function() {
assert.equal(
assert.strictEqual(
new Color(100)
.toString(),
'white'
);
});

it('works with brightness and alpha arguments', function() {
assert.equal(
assert.strictEqual(
new Color(100, 0.5)
.toString(),
'rgba(255, 255, 255, 0.5)'
Expand All @@ -55,55 +55,55 @@ describe('Color Creation', function() {

describe('#fromString', function() {
it('works with color name', function() {
assert.equal(
assert.strictEqual(
Color.fromString('red')
.toString(),
'red'
);
});

it('works with hex string', function() {
assert.equal(
assert.strictEqual(
Color.fromString('#ff0000')
.toString(),
'red'
);
});

it('works with short hex string', function() {
assert.equal(
assert.strictEqual(
Color.fromString('#f00')
.toString(),
'red'
);
});

it('works with rgb string', function() {
assert.equal(
assert.strictEqual(
Color.fromString('rgb(255, 0, 0)')
.toString(),
'red'
);
});

it('works with rgba string', function() {
assert.equal(
assert.strictEqual(
Color.fromString('rgba(255, 0, 0, 1)')
.toString(),
'red'
);
});

it('works with hsl string', function() {
assert.equal(
assert.strictEqual(
Color.fromString('hsl(155, 30%, 70%)')
.toString(),
'#9cc9b6'
);
});

it('works with hsla string', function() {
assert.equal(
assert.strictEqual(
Color.fromString('hsla(180, 100%, 30%, .5)')
.toString(),
'rgba(0, 153, 153, 0.5)'
Expand Down Expand Up @@ -149,15 +149,15 @@ describe('Color Creation', function() {

describe('#fromRGB', function() {
it('works with rgb arguments', function() {
assert.equal(
assert.strictEqual(
Color.fromRGB(155, 30, 70)
.toString(),
'#9b1e46'
);
});

it('works with alpha argument', function() {
assert.equal(
assert.strictEqual(
Color.fromRGB(180, 100, 30, .5)
.toString(),
'rgba(180, 100, 30, 0.5)'
Expand All @@ -167,15 +167,15 @@ describe('Color Creation', function() {

describe('#fromHSL', function() {
it('works with hsl arguments', function() {
assert.equal(
assert.strictEqual(
Color.fromHSL(155, 30, 70)
.toString(),
'#9cc9b6'
);
});

it('works with alpha argument', function() {
assert.equal(
assert.strictEqual(
Color.fromHSL(180, 100, 30, .5)
.toString(),
'rgba(0, 153, 153, 0.5)'
Expand All @@ -185,15 +185,15 @@ describe('Color Creation', function() {

describe('#fromHSV', function() {
it('works with hsv arguments', function() {
assert.equal(
assert.strictEqual(
Color.fromHSV(155, 30, 70)
.toString(),
'#7db39c'
);
});

it('works with alpha argument', function() {
assert.equal(
assert.strictEqual(
Color.fromHSV(180, 100, 30, .5)
.toString(),
'rgba(0, 77, 77, 0.5)'
Expand All @@ -203,15 +203,15 @@ describe('Color Creation', function() {

describe('#fromCMY', function() {
it('works with cmy arguments', function() {
assert.equal(
assert.strictEqual(
Color.fromCMY(77, 15, 35)
.toString(),
'#3bd9a6'
);
});

it('works with alpha argument', function() {
assert.equal(
assert.strictEqual(
Color.fromCMY(90, 50, 15, .5)
.toString(),
'rgba(25, 128, 217, 0.5)'
Expand All @@ -221,15 +221,15 @@ describe('Color Creation', function() {

describe('#fromCMYK', function() {
it('works with cmyk arguments', function() {
assert.equal(
assert.strictEqual(
Color.fromCMYK(77, 15, 35, 45)
.toString(),
'#20775b'
);
});

it('works with alpha argument', function() {
assert.equal(
assert.strictEqual(
Color.fromCMYK(90, 50, 15, 55, .5)
.toString(),
'rgba(11, 57, 98, 0.5)'
Expand Down
Loading

0 comments on commit cbd631c

Please sign in to comment.