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

pass args to super #25

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion addon/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import isEqual from 'lodash-es/isEqual';

export default Mixin.create({
init() {
this._super();
this._super(...arguments);
this._relationshipTracker = Object.create(null);
},

Expand Down
15 changes: 15 additions & 0 deletions tests/integration/mixins/track-relationships-test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import Model, { hasMany, belongsTo, attr } from '@ember-data/model';
import JSONAPISerializer from '@ember-data/serializer/json-api';
import { run } from '@ember/runloop';
import EmberObject from '@ember/object';
import { resolve, all } from 'rsvp';
import { module, test } from 'qunit';
import { setupRenderingTest } from 'ember-qunit';
Expand Down Expand Up @@ -417,3 +418,17 @@ module('Integration | Mixin | track relationships as Class', function(hooks) {
});
});
});

module('Integration | Mixin | base class init receives args', function () {
test('it receives args', function (assert) {
let receivedArgs;
class ExampleModel extends EmberObject.extend(TrackRelationships) {
init() {
receivedArgs = arguments;
}
}
const model = new ExampleModel();
model.init(['a', 3]);
assert.deepEqual(receivedArgs, ['a', 3]);
});
});