From d2d6e2790e4146215baa5cdc5175d238574c1b86 Mon Sep 17 00:00:00 2001 From: Trent Willis Date: Thu, 4 Aug 2016 09:59:27 -0700 Subject: [PATCH] [BUGFIX beta] Pass environment options forward to Engines This fixes a failing test introduced in the previous test where Engines rendered even though shouldRender was set to false. --- packages/ember-application/lib/system/engine-instance.js | 6 +++++- .../tests/system/application_instance_test.js | 6 ++++-- packages/ember-htmlbars/tests/integration/mount_test.js | 1 + 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/packages/ember-application/lib/system/engine-instance.js b/packages/ember-application/lib/system/engine-instance.js index bac35c5317b..64c0ea29fcd 100644 --- a/packages/ember-application/lib/system/engine-instance.js +++ b/packages/ember-application/lib/system/engine-instance.js @@ -179,8 +179,12 @@ if (isEnabled('ember-application-engines')) { [ 'router:main', P`-bucket-cache:main`, - '-view-registry:main' + '-view-registry:main', + '-environment:main' ].forEach(key => this.register(key, parent.lookup(key), { instantiate: false })); + + this.inject('view', '_environment', '-environment:main'); + this.inject('route', '_environment', '-environment:main'); } }); } diff --git a/packages/ember-application/tests/system/application_instance_test.js b/packages/ember-application/tests/system/application_instance_test.js index 4d05d71fd4f..60ae70a150b 100644 --- a/packages/ember-application/tests/system/application_instance_test.js +++ b/packages/ember-application/tests/system/application_instance_test.js @@ -141,7 +141,7 @@ QUnit.test('unregistering a factory clears all cached instances of that factory' if (isEnabled('ember-application-engines')) { QUnit.test('can build and boot a registered engine', function(assert) { - assert.expect(7); + assert.expect(8); let ChatEngine = Engine.extend(); let chatEngineInstance; @@ -150,6 +150,7 @@ if (isEnabled('ember-application-engines')) { run(() => { appInstance = ApplicationInstance.create({ application }); + appInstance.setupRegistry(); chatEngineInstance = appInstance.buildChildEngineInstance('chat'); }); @@ -171,7 +172,8 @@ if (isEnabled('ember-application-engines')) { [ 'router:main', P`-bucket-cache:main`, - '-view-registry:main' + '-view-registry:main', + '-environment:main' ].forEach(key => { assert.strictEqual( chatEngineInstance.lookup(key), diff --git a/packages/ember-htmlbars/tests/integration/mount_test.js b/packages/ember-htmlbars/tests/integration/mount_test.js index 6c3877e9a20..127a917dccc 100644 --- a/packages/ember-htmlbars/tests/integration/mount_test.js +++ b/packages/ember-htmlbars/tests/integration/mount_test.js @@ -40,6 +40,7 @@ function commonSetup() { app.register('component-lookup:main', ComponentLookup); appInstance = app.buildInstance(); + appInstance.setupRegistry(); }); }