| Tests for the WI.Color model object. |
| |
| |
| == Running test suite: WI.Color |
| -- Running test case: WI.Color.fromString |
| PASS: '#000' should be detected |
| PASS: '#000' was the expected 'Short HEX' format |
| PASS: '#a0A' should be detected |
| PASS: '#a0A' was the expected 'Short HEX' format |
| PASS: '#000000' should be detected |
| PASS: '#000000' was the expected 'HEX' format |
| PASS: '#a0Aa0A' should be detected |
| PASS: '#a0Aa0A' was the expected 'HEX' format |
| PASS: '#0000' should be detected |
| PASS: '#0000' was the expected 'Short HEX with Alpha' format |
| PASS: '#a0Af' should be detected |
| PASS: '#a0Af' was the expected 'Short HEX with Alpha' format |
| PASS: '#00000000' should be detected |
| PASS: '#00000000' was the expected 'HEX with Alpha' format |
| PASS: '#a0Aa0Aff' should be detected |
| PASS: '#a0Aa0Aff' was the expected 'HEX with Alpha' format |
| PASS: 'rgb(1,2,3)' should be detected |
| PASS: 'rgb(1,2,3)' was the expected 'RGB' format |
| PASS: 'RGB(1,2,3)' should be detected |
| PASS: 'RGB(1,2,3)' was the expected 'RGB' format |
| PASS: 'rgb(999, 999, 999)' should be detected |
| PASS: 'rgb(999, 999, 999)' was the expected 'RGB' format |
| PASS: 'rgb( 1 , 1 , 1 )' should be detected |
| PASS: 'rgb( 1 , 1 , 1 )' was the expected 'RGB' format |
| PASS: 'rgba(1,2,3,0)' should be detected |
| PASS: 'rgba(1,2,3,0)' was the expected 'RGBA' format |
| PASS: 'RGBA(1,2,3,0)' should be detected |
| PASS: 'RGBA(1,2,3,0)' was the expected 'RGBA' format |
| PASS: 'rgba(999, 999, 999, 999)' should be detected |
| PASS: 'rgba(999, 999, 999, 999)' was the expected 'RGBA' format |
| PASS: 'rgba( 1 , 1 , 1 , 0.5 )' should be detected |
| PASS: 'rgba( 1 , 1 , 1 , 0.5 )' was the expected 'RGBA' format |
| PASS: 'hsl(0, 0%, 50%)' should be detected |
| PASS: 'hsl(0, 0%, 50%)' was the expected 'HSL' format |
| PASS: 'HSL(0, 0%, 50%)' should be detected |
| PASS: 'HSL(0, 0%, 50%)' was the expected 'HSL' format |
| PASS: 'hsl(999, 999%, 999%)' should be detected |
| PASS: 'hsl(999, 999%, 999%)' was the expected 'HSL' format |
| PASS: 'hsl( 0 , 0% , 50% )' should be detected |
| PASS: 'hsl( 0 , 0% , 50% )' was the expected 'HSL' format |
| PASS: 'hsla(0, 0%, 50%, 0)' should be detected |
| PASS: 'hsla(0, 0%, 50%, 0)' was the expected 'HSLA' format |
| PASS: 'HSLA(0, 0%, 50%, 0)' should be detected |
| PASS: 'HSLA(0, 0%, 50%, 0)' was the expected 'HSLA' format |
| PASS: 'hsla(999, 999%, 999%, 999)' should be detected |
| PASS: 'hsla(999, 999%, 999%, 999)' was the expected 'HSLA' format |
| PASS: 'hsla( 0 , 0% , 50% , 0.5 )' should be detected |
| PASS: 'hsla( 0 , 0% , 50% , 0.5 )' was the expected 'HSLA' format |
| PASS: 'blue' should be detected |
| PASS: 'blue' was the expected 'Keyword' format |
| PASS: 'BLuE' should be detected |
| PASS: 'BLuE' was the expected 'Keyword' format |
| PASS: 'midnightblue' should be detected |
| PASS: 'midnightblue' was the expected 'Keyword' format |
| PASS: 'royalblue' should be detected |
| PASS: 'royalblue' was the expected 'Keyword' format |
| PASS: 'steelblue' should be detected |
| PASS: 'steelblue' was the expected 'Keyword' format |
| PASS: 'transparent' should be detected |
| PASS: 'transparent' was the expected 'Keyword' format |
| |
| PASS: ' #000 ' should not be detected |
| PASS: '#rgb' should not be detected |
| PASS: '#1' should not be detected |
| PASS: '#12' should not be detected |
| PASS: '#12345' should not be detected |
| PASS: '#1234567' should not be detected |
| PASS: '#123456789' should not be detected |
| PASS: 'rgb(255, 255, 255, 0.5)' should not be detected |
| PASS: 'rgba(255, 255, 255, 0.5, 1)' should not be detected |
| PASS: 'hsl(0, 0%, 50%, 1)' should not be detected |
| PASS: 'hsla(0, 0%, 50%, 1, 2)' should not be detected |
| PASS: 'superblue' should not be detected |
| |
| -- Running test case: WI.Color properties |
| PASS: 'red' should have alpha of 1. |
| PASS: 'red' should be simple. |
| PASS: 'red' should be a keyword. |
| PASS: 'red' has rgb of [255, 0, 0]. |
| PASS: 'red' has rgba of [255, 0, 0, 1]. |
| PASS: 'red' has hsl of [0, 100, 50]. |
| PASS: 'red' has hsla of [0, 100, 50, 1]. |
| PASS: 'red' should be serializable as a short Hex |
| PASS: 'transparent' should have alpha of 0. |
| PASS: 'transparent' should not be simple. |
| PASS: 'transparent' should be a keyword. |
| PASS: 'transparent' has rgb of [0, 0, 0]. |
| PASS: 'transparent' has rgba of [0, 0, 0, 0]. |
| PASS: 'transparent' has hsl of [0, 0, 0]. |
| PASS: 'transparent' has hsla of [0, 0, 0, 0]. |
| PASS: 'transparent' should be serializable as a short Hex |
| PASS: '#11122233' should not have alpha of 0. |
| PASS: '#11122233' should be not be simple. |
| PASS: '#11122233' should not be a keyword. |
| PASS: '#11122233' has rgba of [17, 18, 34, 0.2]. |
| PASS: '#11122233' has hsla of [236, 33, 10, 0.2]. |
| PASS: '#11122233' should not be serializable as a short Hex |
| PASS: '#11223344' should be serializable as a short Hex |
| PASS: '#11223345' should not be serializable as a short Hex |
| |
| -- Running test case: WI.Color from components |
| Check components for color 'rgb(255, 0, 0)'. |
| PASS: Should have rgb of [255,0,0]. |
| PASS: Should have rgba of [255,0,0,1]. |
| PASS: Should have hsl of [0,100,50]. |
| PASS: Should have hsla of [0,100,50,1]. |
| Check components for color 'rgba(128, 128, 128, 0.5)'. |
| PASS: Should have rgb of [128,128,128]. |
| PASS: Should have rgba of [128,128,128,0.5]. |
| PASS: Should have hsl of [0,0,50]. |
| PASS: Should have hsla of [0,0,50,0.5]. |
| Check components for color 'hsl(0, 0%, 50%)'. |
| PASS: Should have rgb of [128,128,128]. |
| PASS: Should have rgba of [128,128,128,1]. |
| PASS: Should have hsl of [0,0,50]. |
| PASS: Should have hsla of [0,0,50,1]. |
| Check components for color 'hsla(0, 0%, 50%, 0.5)'. |
| PASS: Should have rgb of [128,128,128]. |
| PASS: Should have rgba of [128,128,128,0.5]. |
| PASS: Should have hsl of [0,0,50]. |
| PASS: Should have hsla of [0,0,50,0.5]. |
| |
| -- Running test case: WI.Color.prototype.nextFormat |
| PASS: All format phases of 'transparent' should be as expected. |
| PASS: All format phases of 'red' should be as expected. |
| PASS: All format phases of 'rgb(100, 150, 200)' should be as expected. |
| PASS: All format phases of 'rgba(100, 150, 200, 0.5)' should be as expected. |
| |
| -- Running test case: WI.Color.prototype.toString |
| PASS: Color as 'Original' should be 'RED' |
| PASS: Color as 'Keyword' should be 'red' |
| PASS: Color as 'Short HEX' should be '#f00' |
| PASS: Color as 'HEX' should be '#ff0000' |
| PASS: Color as 'Short HEX with Alpha' should be '#f00f' |
| PASS: Color as 'HEX with Alpha' should be '#ff0000ff' |
| PASS: Color as 'RGB' should be 'rgb(255, 0, 0)' |
| PASS: Color as 'RGBA' should be 'rgba(255, 0, 0, 1)' |
| PASS: Color as 'HSL' should be 'hsl(0, 100%, 50%)' |
| PASS: Color as 'HSLA' should be 'hsla(0, 100%, 50%, 1)' |
| PASS: Color as 'Original' should be 'rgba(100, 200, 255, 0.5)' |
| PASS: Color as 'Keyword' should be 'rgba(100, 200, 255, 0.5)' |
| PASS: Color as 'Short HEX' should be 'rgba(100, 200, 255, 0.5)' |
| PASS: Color as 'HEX' should be 'rgba(100, 200, 255, 0.5)' |
| PASS: Color as 'Short HEX with Alpha' should be '#64c8ff80' |
| PASS: Color as 'HEX with Alpha' should be '#64c8ff80' |
| PASS: Color as 'RGB' should be 'rgba(100, 200, 255, 0.5)' |
| PASS: Color as 'RGBA' should be 'rgba(100, 200, 255, 0.5)' |
| PASS: Color as 'HSL' should be 'hsla(201, 100%, 70%, 0.5)' |
| PASS: Color as 'HSLA' should be 'hsla(201, 100%, 70%, 0.5)' |
| |
| -- Running test case: WI.Color.rgb2hsv |
| PASS: Should convert [0,0,0] to [0,0,0]. |
| PASS: Should convert [255,255,255] to [0,0,1]. |
| PASS: Should convert [255,0,0] to [0,1,1]. |
| PASS: Should convert [0,255,0] to [120,1,1]. |
| PASS: Should convert [0,0,255] to [240,1,1]. |
| PASS: Should convert [-1,-1,-1] to [0,0,0]. |
| PASS: Should convert [256,256,256] to [0,0,1]. |
| PASS: Should convert [254.9,0,0] to [0,1,1]. |
| |
| -- Running test case: WI.Color.cmyk2rgb |
| PASS: Should convert [0,0,0,1] to [0,0,0]. |
| PASS: Should convert [1,0,0,0] to [0,255,255]. |
| PASS: Should convert [0,1,0,0] to [255,0,255]. |
| PASS: Should convert [0,0,1,0] to [255,255,0]. |
| PASS: Should convert [0,0,0,0] to [255,255,255]. |
| PASS: Should convert [2,0,0,0] to [0,255,255]. |
| PASS: Should convert [-1,0,0,0] to [255,255,255]. |
| |
| -- Running test case: WI.Color.normalized2rgb |
| PASS: Should convert [0,0,0] to [0,0,0]. |
| PASS: Should convert [1,1,1] to [255,255,255]. |
| PASS: Should convert [0.24,0.25,0.26] to [61,64,66]. |
| PASS: Should convert [2,0,0] to [255,0,0]. |
| PASS: Should convert [-1,0,0] to [0,0,0]. |
| |