diff --git a/src/style_manager/view/PropertyStackView.js b/src/style_manager/view/PropertyStackView.js index 24940c7513..bfc5012040 100644 --- a/src/style_manager/view/PropertyStackView.js +++ b/src/style_manager/view/PropertyStackView.js @@ -276,7 +276,6 @@ module.exports = PropertyCompositeView.extend({ fieldName = 'values'; a = this.getLayersFromTarget(); } else { - //var v = this.getComponentValue(); var v = this.getTargetValue(); var vDef = this.getDefaultValue(); v = v == vDef ? '' : v; diff --git a/src/style_manager/view/PropertyView.js b/src/style_manager/view/PropertyView.js index 18bf8c6807..1e043008fe 100644 --- a/src/style_manager/view/PropertyView.js +++ b/src/style_manager/view/PropertyView.js @@ -214,49 +214,11 @@ module.exports = Backbone.View.extend({ * @return {Boolean} * */ sameValue() { - return this.getComponentValue() == this.getValueForTarget(); - }, - - - /** - * Get the value from the selected component of this property - * @return {String} - * @deprecated use getTargetValue - * */ - getComponentValue() { - var propModel = this.model; - var target = this.getTargetModel(); - - if(!target) - return; - - var targetProp = target.get('style')[this.property]; - if(targetProp) - this.componentValue = targetProp; - else - this.componentValue = this.model.getDefaultValue() + (this.unit || ''); // todo model - - // Check if wrap inside function is required - if (propModel.get('functionName')) { - var v = this.fetchFromFunction(this.componentValue); - if(v) - this.componentValue = v; - } - - // This allow to ovveride the normal flow of selecting component value, - // useful in composite properties - if(this.customValue && typeof this.customValue === "function"){ - var index = propModel.collection.indexOf(propModel); - var t = this.customValue(this, index); - if(t) - this.componentValue = t; - } - - return this.componentValue; + return this.getTargetValue() == this.getValueForTarget(); }, /** - * Refactor of getComponentValue + * Get the value of this property from the target (eg, Component, CSSRule) * @param {Object} [opts] Options * @param {Boolean} [options.fetchFromFunction] * @param {Boolean} [options.ignoreDefault] diff --git a/test/specs/style_manager/view/PropertyView.js b/test/specs/style_manager/view/PropertyView.js index aee1d53820..87443c36fa 100644 --- a/test/specs/style_manager/view/PropertyView.js +++ b/test/specs/style_manager/view/PropertyView.js @@ -124,21 +124,21 @@ module.exports = { }); it('Target style is empty without values', () => { - expect(view.getComponentValue()).toNotExist(); + expect(view.getTargetValue()).toNotExist(); }); it('Target style is correct', () => { var style = {}; style[propName] = propValue; component.set('style', style); - expect(view.getComponentValue()).toEqual(propValue); + expect(view.getTargetValue()).toEqual(propValue); }); it('Target style is empty with an other style', () => { var style = {}; style[propName + '2'] = propValue; component.set('style', style); - expect(view.getComponentValue()).toNotExist(); + expect(view.getTargetValue()).toNotExist(); }); it('Fetch value from function', () => { @@ -147,7 +147,7 @@ module.exports = { style[propName] = 'testfun(' + propValue + ')'; component.set('style', style); view.model.set('functionName', 'testfun'); - expect(view.getComponentValue()).toEqual(propValue); + expect(view.getTargetValue()).toEqual(propValue); }); describe('With target setted', () => {