Merge pull request #1728 from tschaub/set-values
Make setValues behave like multiple calls to set.
This commit is contained in:
+1
-9
@@ -428,15 +428,7 @@ ol.Object.prototype.set = function(key, value) {
|
|||||||
ol.Object.prototype.setValues = function(values) {
|
ol.Object.prototype.setValues = function(values) {
|
||||||
var key;
|
var key;
|
||||||
for (key in values) {
|
for (key in values) {
|
||||||
var value = values[key];
|
this.set(key, values[key]);
|
||||||
var setterName = ol.Object.getSetterName(key);
|
|
||||||
var setter = /** @type {function(*)|undefined} */
|
|
||||||
(goog.object.get(this, setterName));
|
|
||||||
if (goog.isDef(setter)) {
|
|
||||||
setter.call(this, value);
|
|
||||||
} else {
|
|
||||||
this.set(key, value);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -301,13 +301,6 @@ describe('ol.Feature', function() {
|
|||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
/**
|
|
||||||
* We should be able to make the assertion below, but the constructor
|
|
||||||
* calls setValues which calls setFoo when provided with 'foo'. This
|
|
||||||
* is different behavior than calling set('foo', 'bar').
|
|
||||||
* See https://github.com/openlayers/ol3/issues/1672
|
|
||||||
|
|
||||||
|
|
||||||
it('does not get confused with "style" option to constructor', function() {
|
it('does not get confused with "style" option to constructor', function() {
|
||||||
var feature = new ol.Feature({
|
var feature = new ol.Feature({
|
||||||
style: 'foo'
|
style: 'foo'
|
||||||
@@ -316,8 +309,6 @@ describe('ol.Feature', function() {
|
|||||||
expect(feature.getStyle()).to.be(null);
|
expect(feature.getStyle()).to.be(null);
|
||||||
});
|
});
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
it('does not get confused with user set "style" property', function() {
|
it('does not get confused with user set "style" property', function() {
|
||||||
var feature = new ol.Feature();
|
var feature = new ol.Feature();
|
||||||
feature.set('style', 'foo');
|
feature.set('style', 'foo');
|
||||||
|
|||||||
Reference in New Issue
Block a user