Skip to content

Commit

Permalink
Merge 392d822 into 1abb841
Browse files Browse the repository at this point in the history
  • Loading branch information
dplewis authored Feb 23, 2021
2 parents 1abb841 + 392d822 commit d83e8e8
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 29 deletions.
10 changes: 0 additions & 10 deletions integration/test/ParseObjectTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -414,16 +414,6 @@ describe('Parse Object', () => {
assert.equal(result.get('objectField').unknown, 20);
});

it('ignore set nested fields on new object', async () => {
const obj = new TestObject();
obj.set('objectField.number', 5);
assert.deepEqual(obj._getPendingOps()[0], {});
assert.equal(obj.get('objectField'), undefined);

await obj.save();
assert.equal(obj.get('objectField'), undefined);
});

it('can set nested fields two levels', async () => {
const obj = new TestObject({ objectField: { foo: { bar: 5 } } });
assert.equal(obj.get('objectField').foo.bar, 5);
Expand Down
9 changes: 0 additions & 9 deletions src/ParseObject.js
Original file line number Diff line number Diff line change
Expand Up @@ -741,15 +741,6 @@ class ParseObject {

const currentAttributes = this.attributes;

// Only set nested fields if exists
const serverData = this._getServerData();
if (typeof key === 'string' && key.includes('.')) {
const field = key.split('.')[0];
if (!serverData[field]) {
return this;
}
}

// Calculate new values
const newValues = {};
for (const attr in newOps) {
Expand Down
10 changes: 0 additions & 10 deletions src/__tests__/ParseObject-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -699,16 +699,6 @@ describe('ParseObject', () => {
expect(o.get('objectField').letter).toEqual('a');
});

it('ignore set nested field on new object', () => {
const o = new ParseObject('Person');
o.set('objectField.number', 20);

expect(o.attributes).toEqual({});
expect(o.op('objectField.number') instanceof SetOp).toBe(false);
expect(o.dirtyKeys()).toEqual([]);
expect(o._getSaveJSON()).toEqual({});
});

it('can add elements to an array field', () => {
const o = new ParseObject('Schedule');
o.add('available', 'Monday');
Expand Down

0 comments on commit d83e8e8

Please sign in to comment.