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

[CLEANUP] Remove Ember.Component#defaultLayout #15896

Merged
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: 0 additions & 1 deletion features.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
"ember-debug.deprecate-until-missing": "2.1.0",
"ember-debug.warn-options-missing": "2.1.0",
"ember-debug.warn-id-missing": "2.1.0",
"ember-views.component.defaultLayout": "2.3.0",
"ember-routing-views.controller-wrapped-param": "2.0.0",
"ember-htmlbars.make-bound-helper": "1.13.6",
"ember-htmlbars.ember-handlebars-safestring": "2.8.0",
Expand Down
17 changes: 0 additions & 17 deletions packages/ember-glimmer/lib/component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -571,23 +571,6 @@ const Component = CoreView.extend(
this[ROOT_REF] = new RootReference(this);
this[BOUNDS] = null;

// If a `defaultLayout` was specified move it to the `layout` prop.
// `layout` is no longer a CP, so this just ensures that the `defaultLayout`
// logic is supported with a deprecation
if (this.defaultLayout && !this.layout) {
deprecate(
`Specifying \`defaultLayout\` to ${this} is deprecated. Please use \`layout\` instead.`,
false,
{
id: 'ember-views.component.defaultLayout',
until: '3.0.0',
url: 'https://emberjs.com/deprecations/v2.x/#toc_ember-component-defaultlayout',
},
);

this.layout = this.defaultLayout;
}

// If in a tagless component, assert that no event handlers are defined
assert(
// tslint:disable-next-line:max-line-length
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,42 +118,6 @@ moduleFor('Components test: curly components', class extends RenderingTest {
this.assertText('FIZZ BAR hey');
}

['@test can specify template with `defaultLayout` property [DEPRECATED]']() {
expectDeprecation(/Specifying `defaultLayout` to .* is deprecated. Please use `layout` instead/);
let FooBarComponent = Component.extend({
elementId: 'blahzorz',
defaultLayout: compile('much wat {{lulz}}'),
init() {
this._super(...arguments);
this.lulz = 'hey';
}
});

this.registerComponent('foo-bar', { ComponentClass: FooBarComponent });

this.render('{{foo-bar}}');

this.assertText('much wat hey');
}

['@test layout takes precedence over defaultLayout']() {
let FooBarComponent = Component.extend({
elementId: 'blahzorz',
layout: compile('so much layout wat {{lulz}}'),
defaultLayout: compile('much wat {{lulz}}'),
init() {
this._super(...arguments);
this.lulz = 'hey';
}
});

this.registerComponent('foo-bar', { ComponentClass: FooBarComponent });

this.render('{{foo-bar}}');

this.assertText('so much layout wat hey');
}

['@test layout supports computed property']() {
let FooBarComponent = Component.extend({
elementId: 'blahzorz',
Expand Down
49 changes: 1 addition & 48 deletions packages/ember/tests/component_registration_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,53 +120,6 @@ moduleFor('Application Lifecycle - Component Registration', class extends Autobo
assert.equal(text, 'inner-outer', 'The component is composed correctly');
}

['@test Assigning defaultLayout to a component should set it up as a layout if no layout was found [DEPRECATED]'](assert) {
assert.expect(2);

expectDeprecation(() => {
this.runTask(() => {
this.createApplication();

this.addTemplate('application', `<div id='wrapper'>{{#my-component}}{{text}}{{/my-component}}</div>`);

this.applicationInstance.register('controller:application', Controller.extend({
text: 'outer'
}));
this.applicationInstance.register('component:my-component', Component.extend({
text: 'inner',
defaultLayout: this.compile('{{text}}-{{yield}}')
}));
});
});

let text = this.$('#wrapper').text().trim();
assert.equal(text, 'inner-outer', 'The component is composed correctly');
}

['@test Assigning defaultLayout to a component should set it up as a layout if layout was found [DEPRECATED]'](assert) {
assert.expect(2);

expectDeprecation(() => {
this.runTask(() => {
this.createApplication();

this.addTemplate('application', `<div id='wrapper'>{{#my-component}}{{text}}{{/my-component}}</div>`);
this.addTemplate('components/my-component', '{{text}}-{{yield}}');

this.applicationInstance.register('controller:application', Controller.extend({
text: 'outer'
}));
this.applicationInstance.register('component:my-component', Component.extend({
text: 'inner',
defaultLayout: this.compile('should not see this!')
}));
});
}, /Specifying `defaultLayout` to .+ is deprecated\./);

let text = this.$('#wrapper').text().trim();
assert.equal(text, 'inner-outer', 'The component is composed correctly');
}

/*
* When an exception is thrown during the initial rendering phase, the
* `visit` promise is not resolved or rejected. This means the `applicationInstance`
Expand Down Expand Up @@ -195,4 +148,4 @@ moduleFor('Application Lifecycle - Component Registration', class extends Autobo
});
}, /.* named "no-good" .*/);
}
});
});