Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion addon/initializer.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* global require */
export function initializer() {
require('ember-data-change-tracker/model-ext');
}
}
2 changes: 1 addition & 1 deletion addon/model-ext.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,4 +118,4 @@ Model.reopen({
Tracker.clear(this);
})

});
});
18 changes: 18 additions & 0 deletions tests/unit/model-test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import Ember from 'ember';
const {run} = Ember;

import FactoryGuy, {
build, make, makeList, mockUpdate, mockFindRecord, mockReload,
mockDelete, manualSetup, mockSetup, mockTeardown
Expand Down Expand Up @@ -251,6 +253,22 @@ test('#changed ( modifying ) attribute of type undefined', function(assert) {
assert.ok(changed);
});

test('#changed ( modifying ) attribute of type undefined then saveChanges', function(assert) {
let company = make('company', { name: 'blu' }),
changed;
company.startTrack();

run(() => {
company.set('name', 'bla');
company.saveChanges();
//if we run twice the below, the test passes..
//company._internalModel.flushChangedAttributes();
//company._internalModel.flushChangedAttributes();
changed = company.changed().name;
assert.notOk(changed);
});
});

test('#changed ( modifying ) attribute of type that does not serialize to string', function(assert) {
let blob = { foo: 1 };
let user = make('user', { blob });
Expand Down