return false;
}
}
- return _createResolver([...set], [''], rootScopes, fallback, () => {
- const parent = resolver._getTarget();
- if (!(prop in parent)) {
- parent[prop] = {};
- }
- return parent[prop];
- });
+ return _createResolver([...set], [''], rootScopes, fallback,
+ () => subGetTarget(resolver, prop, value));
}
function addScopesFromKey(set, allScopes, key, fallback) {
return key;
}
+function subGetTarget(resolver, prop, value) {
+ const parent = resolver._getTarget();
+ if (!(prop in parent)) {
+ parent[prop] = {};
+ }
+ const target = parent[prop];
+ if (isArray(target) && isObject(value)) {
+ // For array of objects, the object is used to store updated values
+ return value;
+ }
+ return target;
+}
+
function _resolveWithPrefixes(prop, prefixes, scopes, proxy) {
let value;
for (const prefix of prefixes) {
expect(fn()).toEqual('ok');
});
+ it('should properly set value to object in array of objects', function() {
+ const defaults = {};
+ const options = {
+ annotations: [{
+ value: 10
+ }, {
+ value: 20
+ }]
+ };
+ const resolver = _attachContext(_createResolver([options, defaults]), {test: true});
+ expect(resolver.annotations[0].value).toEqual(10);
+
+ resolver.annotations[0].value = 15;
+ expect(options.annotations[0].value).toEqual(15);
+ expect(options.annotations[1].value).toEqual(20);
+ });
+
describe('_indexable and _scriptable', function() {
it('should default to true', function() {
const options = {