1suite('color-handler', function() { 2 test('parse colors', function() { 3 assert.deepEqual(parseColor(' ReD '), [255, 0, 0, 1]); 4 assert.deepEqual(parseColor(' magenta'), [255, 0, 255, 1]); 5 assert.deepEqual(parseColor('transparent'), [0, 0, 0, 0]); 6 assert.deepEqual(parseColor('#0f0'), [0, 255, 0, 1]); 7 assert.deepEqual(parseColor('rgb(0,10,20)'), [0, 10, 20, 1]); 8 assert.deepEqual(parseColor('rgba(65,40,20,0.2)'), [13, 8, 4, 0.2]); 9 assert.deepEqual(parseColor('hsl(120, 100%, 50%)'), [0, 255, 0, 1]); 10 }); 11 test('invalid colors fail to parse', function() { 12 assert.isUndefined(parseColor('')); 13 assert.isUndefined(parseColor('bananayellow')); 14 assert.isUndefined(parseColor('rgb(10, 20, 30, 40)')); 15 }); 16 test('color interpolation', function() { 17 assert.equal(webAnimations1.propertyInterpolation('color', '#00aa11', '#aa00bb')(0.2), 'rgba(34,136,51,1)'); 18 assert.equal(webAnimations1.propertyInterpolation('color', 'transparent', '#004488')(0), 'transparent'); 19 assert.equal(webAnimations1.propertyInterpolation('color', 'transparent', '#004488')(0.5), 'rgba(0,68,136,0.500)'); 20 assert.equal(webAnimations1.propertyInterpolation('color', 'red', 'green')(2), 'rgba(0,255,0,1)'); 21 assert.equal(webAnimations1.propertyInterpolation('color', 'red', 'green')(-1), 'rgba(255,0,0,1)'); 22 }); 23}); 24