From 2c36f3a62ecfc8abae0fdbe361442bea74caa6c0 Mon Sep 17 00:00:00 2001 From: Jonathan Puckey Date: Sun, 15 May 2011 14:11:35 +0200 Subject: [PATCH] Fix bug in Color#read. --- src/color/Color.js | 3 ++- test/tests/Color.js | 5 +++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/color/Color.js b/src/color/Color.js index 187ed759..ab9c955f 100644 --- a/src/color/Color.js +++ b/src/color/Color.js @@ -91,7 +91,8 @@ var Color = this.Color = Base.extend(new function() { ? rgbColor.convert(this._colorType) : rgbColor; } else { - var components = isArray ? arg : arguments; + var components = isArray ? arg + : arguments;//Array.prototype.slice.call(arguments); if (!this._colorType) { // Called on the abstract Color class. Guess color type // from arg diff --git a/test/tests/Color.js b/test/tests/Color.js index 32da7d1f..abf078bd 100644 --- a/test/tests/Color.js +++ b/test/tests/Color.js @@ -153,4 +153,9 @@ test('Setting HSBColor#gray', function() { var color = new HSBColor(180, 0, 0); color.gray = 0.5; compareHSBColors(color, [0, 0, 0.5, 1]); +}); + +test('Color.read(channels)', function() { + var color = Color.read([0, 0, 1]); + compareRGBColors(color, [0, 0, 1, 1]); }); \ No newline at end of file