Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Unified Diff: polymer_0.5.0/bower_components/web-animations-js/test/js/color-handler.js

Issue 786953007: npm_modules: Fork bower_components into Polymer 0.4.0 and 0.5.0 versions (Closed) Base URL: https://chromium.googlesource.com/infra/third_party/npm_modules.git@master
Patch Set: Created 5 years, 12 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: polymer_0.5.0/bower_components/web-animations-js/test/js/color-handler.js
diff --git a/polymer_0.5.0/bower_components/web-animations-js/test/js/color-handler.js b/polymer_0.5.0/bower_components/web-animations-js/test/js/color-handler.js
new file mode 100644
index 0000000000000000000000000000000000000000..5689516e1139d8696177ac402e9cb451dd86849a
--- /dev/null
+++ b/polymer_0.5.0/bower_components/web-animations-js/test/js/color-handler.js
@@ -0,0 +1,23 @@
+suite('color-handler', function() {
+ test('parse colors', function() {
+ assert.deepEqual(parseColor(' ReD '), [255, 0, 0, 1]);
+ assert.deepEqual(parseColor(' magenta'), [255, 0, 255, 1]);
+ assert.deepEqual(parseColor('transparent'), [0, 0, 0, 0]);
+ assert.deepEqual(parseColor('#0f0'), [0, 255, 0, 1]);
+ assert.deepEqual(parseColor('rgb(0,10,20)'), [0, 10, 20, 1]);
+ assert.deepEqual(parseColor('rgba(65,40,20,0.2)'), [13, 8, 4, 0.2]);
+ assert.deepEqual(parseColor('hsl(120, 100%, 50%)'), [0, 255, 0, 1]);
+ });
+ test('invalid colors fail to parse', function() {
+ assert.isUndefined(parseColor(''));
+ assert.isUndefined(parseColor('bananayellow'));
+ assert.isUndefined(parseColor('rgb(10, 20, 30, 40)'));
+ });
+ test('color interpolation', function() {
+ assert.equal(webAnimationsMinifill.propertyInterpolation('color', '#00aa11', '#aa00bb')(0.2), 'rgba(34,136,51,1)');
+ assert.equal(webAnimationsMinifill.propertyInterpolation('color', 'transparent', '#004488')(0), 'transparent');
+ assert.equal(webAnimationsMinifill.propertyInterpolation('color', 'transparent', '#004488')(0.5), 'rgba(0,68,136,0.500)');
+ assert.equal(webAnimationsMinifill.propertyInterpolation('color', 'red', 'green')(2), 'rgba(0,255,0,1)');
+ assert.equal(webAnimationsMinifill.propertyInterpolation('color', 'red', 'green')(-1), 'rgba(255,0,0,1)');
+ });
+});

Powered by Google App Engine
This is Rietveld 408576698