Skip to content

Commit

Permalink
Remove implicit store injection for Ember v4.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
snewcomer committed Aug 20, 2021
1 parent 762d6f6 commit ca96cd3
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 42 deletions.
7 changes: 0 additions & 7 deletions packages/-ember-data/addon/setup-container.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,6 @@ function initializeStore(application) {
}
}

function initializeStoreInjections(application) {
let inject = application.inject || application.injection;
inject.call(application, 'controller', 'store', 'service:store');
inject.call(application, 'route', 'store', 'service:store');
}

export default function setupContainer(application) {
initializeStoreInjections(application);
initializeStore(application);
}
3 changes: 0 additions & 3 deletions packages/-ember-data/app/initializers/ember-data.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@ import setupContainer from 'ember-data/setup-container';

/*
This code initializes EmberData in an Ember application.
It ensures that the `store` service is automatically injected
as the `store` property on all routes and controllers.
*/
export default {
name: 'ember-data',
Expand Down
32 changes: 0 additions & 32 deletions packages/-ember-data/tests/integration/injection-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,35 +37,3 @@ module('integration/injection factoryFor enabled', function (hooks) {
});
});

module('integration/injection eager injections', function (hooks) {
setupTest(hooks);
let store;
let Apple = Service.extend();

hooks.beforeEach(function () {
let { owner } = this;

owner.register('model:foo', Model.extend());
owner.register('service:apple', Apple);
owner.inject('model:foo', 'apple', 'service:apple');

store = this.owner.lookup('service:store');
});

test('did inject', async function (assert) {
// TODO likely this test should instead test that we can use service injections
// on models (e.g. that owner is properly setup for it).
assert.expectDeprecation(
() => {
let foo = store.createRecord('foo');
let apple = foo.get('apple');
let appleService = this.owner.lookup('service:apple');

assert.ok(apple, `'model:foo' instance should have an 'apple' property`);
assert.ok(apple === appleService, `'model:foo.apple' should be the apple service`);
assert.ok(apple instanceof Apple, `'model:foo'.apple should be an instance of 'service:apple'`);
},
{ id: 'implicit-injections', count: 1, when: { ember: '>=3.27.0' } }
);
});
});

0 comments on commit ca96cd3

Please sign in to comment.