Skip to content

Commit

Permalink
Merge pull request #11253 from teddyzeenny/reset-bug
Browse files Browse the repository at this point in the history
[BUGFIX release] always pass instance to instance initializers
  • Loading branch information
rwjblue committed May 22, 2015
2 parents 8a82918 + 8415914 commit 10f772a
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 3 deletions.
4 changes: 1 addition & 3 deletions packages/ember-application/lib/system/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -664,9 +664,7 @@ var Application = Namespace.extend(DeferredMixin, {
function handleReset() {
run(instance, 'destroy');

this.buildDefaultInstance();

run.schedule('actions', this, 'domReady');
run.schedule('actions', this, 'domReady', this.buildDefaultInstance());
}

run.join(this, handleReset);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -362,4 +362,26 @@ if (Ember.FEATURES.isEnabled('ember-application-instance-initializers')) {
});
});
}

QUnit.test("Initializers get an instance on app reset", function() {
expect(2);

var MyApplication = Application.extend();

MyApplication.instanceInitializer({
name: 'giveMeAnInstance',
initialize(instance) {
ok(!!instance, 'Initializer got an instance');
}
});

run(function() {
app = MyApplication.create({
router: false,
rootElement: '#qunit-fixture'
});
});

run(app, 'reset');
});
}

0 comments on commit 10f772a

Please sign in to comment.