From 7c94a0dd4eeed098daa8df90d2d9badbd0e6763b Mon Sep 17 00:00:00 2001 From: Thomas Neirynck Date: Wed, 18 Mar 2020 23:19:38 -0400 Subject: [PATCH] retain test --- .../properties/dynamic_color_property.test.js | 39 +++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/x-pack/legacy/plugins/maps/public/layers/styles/vector/properties/dynamic_color_property.test.js b/x-pack/legacy/plugins/maps/public/layers/styles/vector/properties/dynamic_color_property.test.js index 6c63004eefb03..34c7b97d9fa66 100644 --- a/x-pack/legacy/plugins/maps/public/layers/styles/vector/properties/dynamic_color_property.test.js +++ b/x-pack/legacy/plugins/maps/public/layers/styles/vector/properties/dynamic_color_property.test.js @@ -319,6 +319,45 @@ describe('get mapbox color expression (via internal _getMbColor)', () => { const colorProperty = makeProperty(dynamicStyleOptions); expect(colorProperty._getMbColor()).toBeNull(); }); + test('should return mapbox expression for color ramp', async () => { + const dynamicStyleOptions = { + type: COLOR_MAP_TYPE.ORDINAL, + color: 'Blues', + }; + const colorProperty = makeProperty(dynamicStyleOptions); + expect(colorProperty._getMbColor()).toEqual([ + 'interpolate', + ['linear'], + [ + 'coalesce', + [ + 'case', + ['==', ['feature-state', 'foobar'], null], + -1, + ['max', ['min', ['to-number', ['feature-state', 'foobar']], 100], 0], + ], + -1, + ], + -1, + 'rgba(0,0,0,0)', + 0, + '#f7faff', + 12.5, + '#ddeaf7', + 25, + '#c5daee', + 37.5, + '#9dc9e0', + 50, + '#6aadd5', + 62.5, + '#4191c5', + 75, + '#2070b4', + 87.5, + '#072f6b', + ]); + }); }); describe('custom color ramp', () => {