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

[BUGFIX beta] Fix top-level non-default outlet disconnection #10439

Merged
merged 2 commits into from
Feb 12, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Brocfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ var EmberBuild = require('emberjs-build');
var packages = require('./lib/packages');

var emberBuild = new EmberBuild({
htmlbars: require('htmlbars'),
packages: packages
});

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"ember-cli": "0.1.12",
"ember-cli-yuidoc": "^0.4.0",
"ember-publisher": "0.0.7",
"emberjs-build": "0.0.27",
"emberjs-build": "0.0.28",
"express": "^4.5.0",
"github": "^0.2.3",
"glob": "~4.3.2",
Expand Down
4 changes: 3 additions & 1 deletion packages/ember-routing/lib/system/route.js
Original file line number Diff line number Diff line change
Expand Up @@ -1845,6 +1845,7 @@ var Route = EmberObject.extend(ActionHandler, Evented, {
disconnectOutlet: function(options) {
var outletName;
var parentView;
var parent;
if (!options || typeof options === "string") {
outletName = options;
} else {
Expand All @@ -1853,7 +1854,8 @@ var Route = EmberObject.extend(ActionHandler, Evented, {
}

parentView = parentView && parentView.replace(/\//g, '.');
if (parentView === parentRoute(this).routeName) {
parent = parentRoute(this);
if (parent && parentView === parent.routeName) {
parentView = undefined;
}
outletName = outletName || 'main';
Expand Down
32 changes: 32 additions & 0 deletions packages/ember/tests/routing/basic_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -3500,6 +3500,38 @@ QUnit.test("Can render into a named outlet at the top level", function() {
equal(Ember.$('#qunit-fixture').text(), "A-The index-B-Hello world-C", "initial render");
});

QUnit.test("Can disconnect a named outlet at the top level", function() {
Ember.TEMPLATES.application = compile("A-{{outlet}}-B-{{outlet \"other\"}}-C");
Ember.TEMPLATES.modal = compile("Hello world");
Ember.TEMPLATES.index = compile("The index");

registry.register('route:application', Ember.Route.extend({
renderTemplate: function() {
this.render();
this.render('modal', {
into: 'application',
outlet: 'other'
});
},
actions: {
banish: function() {
this.disconnectOutlet({
parentView: 'application',
outlet: 'other'
});
}
}
}));

bootApplication();

equal(Ember.$('#qunit-fixture').text(), "A-The index-B-Hello world-C", "initial render");

Ember.run(router, 'send', 'banish');

equal(Ember.$('#qunit-fixture').text(), "A-The index-B--C", "second render");
});

QUnit.test("Can render into a named outlet at the top level, with empty main outlet", function() {
Ember.TEMPLATES.application = compile("A-{{outlet}}-B-{{outlet \"other\"}}-C");
Ember.TEMPLATES.modal = compile("Hello world");
Expand Down