From 249f3b2e47c39847a267f1c5324eeb3b45a7ed71 Mon Sep 17 00:00:00 2001 From: Tim Schaub Date: Tue, 8 Mar 2016 10:05:38 -0700 Subject: [PATCH] Tests for ol.color.asString() --- test/spec/ol/color.test.js | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/test/spec/ol/color.test.js b/test/spec/ol/color.test.js index d15272e739..d15e761d15 100644 --- a/test/spec/ol/color.test.js +++ b/test/spec/ol/color.test.js @@ -28,6 +28,26 @@ describe('ol.color', function() { }); + describe('ol.color.asString()', function() { + + it('returns the same for a string', function() { + var color = 'rgba(0,1,2,0.3)'; + var got = ol.color.asString(color); + expect(got).to.be(color); + }); + + it('returns a string given an rgba array', function() { + var color = ol.color.asString([1, 2, 3, 0.4]); + expect(color).to.eql('rgba(1,2,3,0.4)'); + }); + + it('returns a string given an rgb array', function() { + var color = ol.color.asString([1, 2, 3]); + expect(color).to.eql('rgba(1,2,3,1)'); + }); + + }); + describe('ol.color.fromString', function() { before(function() {