From 48ac5fc348b242704fea8f7190a3377ee1a02ce7 Mon Sep 17 00:00:00 2001 From: Artur Arseniev Date: Mon, 13 Dec 2021 16:46:12 +0100 Subject: [PATCH] Test detached getStyleFromLayers --- src/style_manager/model/PropertyStack.js | 4 +++- test/specs/style_manager/model/Properties.js | 10 ++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/style_manager/model/PropertyStack.js b/src/style_manager/model/PropertyStack.js index e09255120..60a302a99 100644 --- a/src/style_manager/model/PropertyStack.js +++ b/src/style_manager/model/PropertyStack.js @@ -321,7 +321,9 @@ export default Property.extend({ result[key] = result[key].join(this.__getJoinLayers()); }); - if (!this.isDetached()) { + if (this.isDetached()) { + result[this.getName()] = ''; + } else { const style = this.getProperties().reduce((acc, prop) => { acc[prop.getName()] = ''; return acc; diff --git a/test/specs/style_manager/model/Properties.js b/test/specs/style_manager/model/Properties.js index 0ffc984c8..0f23f80f9 100644 --- a/test/specs/style_manager/model/Properties.js +++ b/test/specs/style_manager/model/Properties.js @@ -187,6 +187,16 @@ describe('StyleManager properties logic', () => { }); }); + test('getStyleFromLayers detached', () => { + compTypeProp.set('detached', true); + expect(compTypeProp.getStyleFromLayers()).toEqual({ + [propTest]: '', + [propATest]: 'valueA-1, valueA-2', + [propBTest]: 'valueB-1, valueB-2', + [propCTest]: 'valueC-1-ext, valueC-2-ext', + }); + }); + test('Layers has the right values', () => { expect(compTypeProp.getLayer(0).getValues()).toEqual({ [propATest]: 'valueA-1',