From c7508cc64fdd416962aa47cb963ed36d033eb8cf Mon Sep 17 00:00:00 2001 From: NullVoxPopuli <199018+NullVoxPopuli@users.noreply.github.com> Date: Fri, 5 Apr 2024 18:22:06 -0400 Subject: [PATCH] Base tests pass again after test harness updates --- .../glimmer/lib/component-managers/curly.ts | 7 +++++++ .../tests/integration/components/append-test.js | 16 ++++++++-------- .../components/template-only-components-test.js | 2 +- 3 files changed, 16 insertions(+), 9 deletions(-) diff --git a/packages/@ember/-internals/glimmer/lib/component-managers/curly.ts b/packages/@ember/-internals/glimmer/lib/component-managers/curly.ts index 23d004c28f5..60c76a13084 100644 --- a/packages/@ember/-internals/glimmer/lib/component-managers/curly.ts +++ b/packages/@ember/-internals/glimmer/lib/component-managers/curly.ts @@ -51,6 +51,7 @@ import { import ComponentStateBucket from '../utils/curly-component-state-bucket'; import { processComponentArgs } from '../utils/process-args'; +import { getComponentTemplate } from '@ember/component'; export const ARGS = enumerableSymbol('ARGS'); export const HAS_BLOCK = enumerableSymbol('HAS_BLOCK'); @@ -133,6 +134,12 @@ export default class CurlyComponentManager let factory: TemplateFactory; if (layout === undefined) { + let theSetTemplate = getComponentTemplate(component); + + if (theSetTemplate) { + return unwrapTemplate(theSetTemplate(owner)).asWrappedLayout(); + } + if (layoutName !== undefined) { let _factory = owner.lookup(`template:${layoutName}`) as TemplateFactory; assert(`Layout \`${layoutName}\` not found!`, _factory !== undefined); diff --git a/packages/@ember/-internals/glimmer/tests/integration/components/append-test.js b/packages/@ember/-internals/glimmer/tests/integration/components/append-test.js index ae7cbd22079..98eb9e9b47b 100644 --- a/packages/@ember/-internals/glimmer/tests/integration/components/append-test.js +++ b/packages/@ember/-internals/glimmer/tests/integration/components/append-test.js @@ -110,7 +110,7 @@ class AbstractAppendTest extends RenderingTestCase { this._super(...arguments); }, }), - template: _options.template, + resolveableTemplate: _options.resolveableTemplate, }; oldRegisterComponent.call(this, name, options); @@ -121,7 +121,7 @@ class AbstractAppendTest extends RenderingTestCase { layoutName: 'components/x-parent', }), - template: + resolveableTemplate: '[parent: {{this.foo}}]{{#x-child bar=this.foo}}[yielded: {{this.foo}}]{{/x-child}}', }); @@ -130,7 +130,7 @@ class AbstractAppendTest extends RenderingTestCase { tagName: '', }), - template: '[child: {{this.bar}}]{{yield}}', + resolveableTemplate: '[child: {{this.bar}}]{{yield}}', }); let XParent; @@ -294,7 +294,7 @@ class AbstractAppendTest extends RenderingTestCase { }, }), - template: + resolveableTemplate: '[parent: {{this.foo}}]{{#x-child bar=this.foo}}[yielded: {{this.foo}}]{{/x-child}}', }); @@ -303,7 +303,7 @@ class AbstractAppendTest extends RenderingTestCase { tagName: '', }), - template: '[child: {{this.bar}}]{{yield}}', + resolveableTemplate: '[child: {{this.bar}}]{{yield}}', }); let XParent; @@ -401,7 +401,7 @@ class AbstractAppendTest extends RenderingTestCase { }, }), - template: 'x-first {{this.foo}}!', + resolveableTemplate: 'x-first {{this.foo}}!', }); this.registerComponent('x-second', { @@ -413,7 +413,7 @@ class AbstractAppendTest extends RenderingTestCase { }, }), - template: 'x-second {{this.bar}}!', + resolveableTemplate: 'x-second {{this.bar}}!', }); let First, Second; @@ -704,7 +704,7 @@ moduleFor( ComponentClass: Component.extend({ layoutName: 'components/foo-bar', }), - template: 'FOO BAR!', + resolveableTemplate: 'FOO BAR!', }); let FooBar = this.owner.factoryFor('component:foo-bar'); diff --git a/packages/@ember/-internals/glimmer/tests/integration/components/template-only-components-test.js b/packages/@ember/-internals/glimmer/tests/integration/components/template-only-components-test.js index e555f5a511a..50780d86b77 100644 --- a/packages/@ember/-internals/glimmer/tests/integration/components/template-only-components-test.js +++ b/packages/@ember/-internals/glimmer/tests/integration/components/template-only-components-test.js @@ -191,7 +191,7 @@ moduleFor( this.registerComponent('foo-bar', { ComponentClass, - template: 'this should not be rendered', + resolveableTemplate: 'this should not be rendered', }); this.render('{{foo-bar}}');