From 5d5e3012202787c89a3c6e09bd799da793c7d3d0 Mon Sep 17 00:00:00 2001 From: fisher-alice <107423305+fisher-alice@users.noreply.github.com> Date: Sat, 3 Dec 2022 17:03:26 -0600 Subject: [PATCH] Assign colors, and then assign colors to keys (#1799) * Assign colors, and then assign colors to keys * added unit test to check RGB.prototype[Animation.keys] initialized --- lib/led/rgb.js | 5 +++-- test/rgb.js | 8 ++++++++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/lib/led/rgb.js b/lib/led/rgb.js index aafb2fb35..3d7c01f41 100644 --- a/lib/led/rgb.js +++ b/lib/led/rgb.js @@ -434,14 +434,15 @@ class RGB { } + +RGB.colors = ["red", "green", "blue"]; + /** * For multi-property animation, must define * the keys to use for tween calculation. */ RGB.prototype[Animation.keys] = RGB.colors; -RGB.colors = ["red", "green", "blue"]; - RGB.ToScaledRGB = (intensity, colors) => { const scale = intensity / 100; diff --git a/test/rgb.js b/test/rgb.js index 536dcbdd4..95a48a598 100644 --- a/test/rgb.js +++ b/test/rgb.js @@ -755,6 +755,14 @@ exports["RGB"] = { test.done(); }, + "Animation.keys"(test) { + test.expect(1); + this.color = this.sandbox.stub(this.rgb, "color"); + const keys = this.rgb[Animation.keys]; + test.deepEqual(keys, ["red", "green", "blue"]); + test.done(); + }, + }; exports["10-bit RGB"] = {