From 40397aa39e31657da69607afebc030e9325b1236 Mon Sep 17 00:00:00 2001 From: Tim Schaub Date: Tue, 8 Mar 2016 10:00:22 -0700 Subject: [PATCH] Tests for ol.color.asArray() --- test/spec/ol/color.test.js | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/test/spec/ol/color.test.js b/test/spec/ol/color.test.js index b0403f3fb2..d15272e739 100644 --- a/test/spec/ol/color.test.js +++ b/test/spec/ol/color.test.js @@ -3,6 +3,31 @@ goog.provide('ol.test.color'); describe('ol.color', function() { + describe('ol.color.asArray()', function() { + + it('returns the same for an array', function() { + var color = [1, 2, 3, 0.4]; + var got = ol.color.asArray(color); + expect(got).to.be(color); + }); + + it('returns an array given an rgba string', function() { + var color = ol.color.asArray('rgba(1,2,3,0.4)'); + expect(color).to.eql([1, 2, 3, 0.4]); + }); + + it('returns an array given an rgb string', function() { + var color = ol.color.asArray('rgb(1,2,3)'); + expect(color).to.eql([1, 2, 3, 1]); + }); + + it('returns an array given a hex string', function() { + var color = ol.color.asArray('#00ccff'); + expect(color).to.eql([0, 204, 255, 1]); + }); + + }); + describe('ol.color.fromString', function() { before(function() {