In a recent update to Ember 3.8 I updated this addon and an existing test (last updated 2 years ago) began failing.
While saving, the record is updated and after the save finalizes the record claims to not have any dirty attributes.
test('String Array - changed and then changed back while inflight', function(assert) {
let record = this.testRecord;
// Sanity check the default values
assert.notOk(record.get('hasDirtyAttributes'), 'Record should start out clean');
assert.deepEqual(record.get('tags').toArray(), ['Kroger', 'Target', 'Meijer'], 'Should start out with the proper tags.');
// Sanity check for saving and dirtyness
Ember.run(function() { record.get('tags').addObject('Remke'); });
assert.deepEqual(record.get('tags').toArray(), ['Kroger', 'Target', 'Meijer', 'Remke'], 'Should have been updated.');
assert.ok(record.get('hasDirtyAttributes'), 'Record now be dirty');
Ember.run(() => { record.save(); });
Ember.run(() => { record.get('tags').removeObject('Remke'); });
Ember.run(() => { this.resumeSave(); });
Ember.run(() => {
// This is where hasDirtyAttributes is coming back false
assert.ok(record.get('hasDirtyAttributes'), 'Record should still be dirty because it was change back in flight');
assert.deepEqual(record.get('tags').toArray(), ['Kroger', 'Target', 'Meijer'], 'Should have been updated.');
});
});
In a recent update to Ember 3.8 I updated this addon and an existing test (last updated 2 years ago) began failing.
While saving, the record is updated and after the save finalizes the record claims to not have any dirty attributes.