Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fragment changed inflight is not returning as dirty #331

Open
ELepolt opened this issue May 17, 2019 · 1 comment
Open

Fragment changed inflight is not returning as dirty #331

ELepolt opened this issue May 17, 2019 · 1 comment

Comments

@ELepolt
Copy link

ELepolt commented May 17, 2019

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.');
  });
});
@ELepolt ELepolt changed the title Fragment changed inflight is not Fragment changed inflight is not returning as dirty Jun 5, 2019
@VincentMolinie
Copy link
Contributor

Hey @ELepolt, did you try with the new beta version 5.0.0-beta.0, it fixes a similar issue for me 😉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants