Merge pull request #1728 from tschaub/set-values

Make setValues behave like multiple calls to set.
This commit is contained in:
Tim Schaub
2014-02-19 12:00:54 -07:00
2 changed files with 1 additions and 18 deletions

View File

@@ -428,15 +428,7 @@ ol.Object.prototype.set = function(key, value) {
ol.Object.prototype.setValues = function(values) {
var key;
for (key in values) {
var value = 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);
}
this.set(key, values[key]);
}
};

View File

@@ -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() {
var feature = new ol.Feature({
style: 'foo'
@@ -316,8 +309,6 @@ describe('ol.Feature', function() {
expect(feature.getStyle()).to.be(null);
});
*/
it('does not get confused with user set "style" property', function() {
var feature = new ol.Feature();
feature.set('style', 'foo');