From aadb2e092aed9d4efbce9ee348f2b248d855f6f9 Mon Sep 17 00:00:00 2001 From: Doug Yun Date: Wed, 17 Aug 2016 11:28:06 -0700 Subject: [PATCH] [BUGFIX beta] Removes `this._environment` guard Fixes #14029 Related to #14085 --- .../tests/system/visit_test.js | 17 +++++++++++++++++ packages/ember-routing/lib/system/route.js | 2 +- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/packages/ember-application/tests/system/visit_test.js b/packages/ember-application/tests/system/visit_test.js index 64a9150eda1..1654c03b83f 100644 --- a/packages/ember-application/tests/system/visit_test.js +++ b/packages/ember-application/tests/system/visit_test.js @@ -358,6 +358,23 @@ QUnit.test('visit() returns a promise that resolves without rendering when shoul }); }); +QUnit.test('visit() renders a template when shouldRender is set to true', function(assert) { + assert.expect(3); + + run(() => { + createApplication(); + + App.register('template:application', compile('

Hello world

')); + }); + + assert.strictEqual(jQuery('#qunit-fixture').children().length, 0, 'there are no elements in the fixture element'); + + return run(App, 'visit', '/', { shouldRender: true }).then(instance => { + assert.ok(instance instanceof ApplicationInstance, 'promise is resolved with an ApplicationInstance'); + assert.strictEqual(jQuery('#qunit-fixture').children().length, 1, 'there is 1 element in the fixture element after visit'); + }); +}); + QUnit.test('visit() returns a promise that resolves without rendering when shouldRender is set to false with Engines', function(assert) { assert.expect(3); diff --git a/packages/ember-routing/lib/system/route.js b/packages/ember-routing/lib/system/route.js index 4e1e1f10b4f..816b40354ab 100644 --- a/packages/ember-routing/lib/system/route.js +++ b/packages/ember-routing/lib/system/route.js @@ -1264,7 +1264,7 @@ let Route = EmberObject.extend(ActionHandler, Evented, { this.setupController(controller, context, transition); - if (!this._environment || this._environment.options.shouldRender) { + if (this._environment.options.shouldRender) { this.renderTemplate(controller, context); } },