@@ -88,7 +88,7 @@ export interface RenderOptions {
88
88
Renders the provided template and appends it to the DOM.
89
89
90
90
@public
91
- @param {Template|Component } templateOrComponent the component (or template) to render
91
+ @param {Template|Component } templateFactoryOrComponent the component (or template) to render
92
92
@param {RenderOptions } options options hash containing engine owner ({ owner: engineOwner })
93
93
@returns {Promise<void> } resolves when settled
94
94
@@ -99,12 +99,12 @@ export interface RenderOptions {
99
99
await render(hbs`<div class="container"></div>`);
100
100
*/
101
101
export function render (
102
- templateOrComponent : object ,
102
+ templateFactoryOrComponent : object ,
103
103
options ?: RenderOptions
104
104
) : Promise < void > {
105
105
let context = getContext ( ) ;
106
106
107
- if ( ! templateOrComponent ) {
107
+ if ( ! templateFactoryOrComponent ) {
108
108
throw new Error ( 'you must pass a template to `render()`' ) ;
109
109
}
110
110
@@ -128,7 +128,7 @@ export function render(
128
128
let OutletTemplate = lookupOutletTemplate ( owner ) ;
129
129
let ownerToRenderFrom = options ?. owner || owner ;
130
130
131
- if ( isComponent ( templateOrComponent ) ) {
131
+ if ( isComponent ( templateFactoryOrComponent ) ) {
132
132
// We use this to track when `render` is used with a component so that we can throw an
133
133
// assertion if `this.{set,setProperty} is used in the same test
134
134
ComponentRenderMap . set ( context , true ) ;
@@ -144,19 +144,16 @@ export function render(
144
144
}
145
145
146
146
context = {
147
- ProvidedComponent : templateOrComponent ,
147
+ ProvidedComponent : templateFactoryOrComponent ,
148
148
} ;
149
- templateOrComponent = INVOKE_PROVIDED_COMPONENT ;
150
- } else {
151
- templateId += 1 ;
152
- let templateFullName = `template:-undertest-${ templateId } ` as const ;
153
- ownerToRenderFrom . register ( templateFullName , templateOrComponent ) ;
154
- templateOrComponent = lookupTemplate (
155
- ownerToRenderFrom ,
156
- templateFullName
157
- ) ;
149
+ templateFactoryOrComponent = INVOKE_PROVIDED_COMPONENT ;
158
150
}
159
151
152
+ templateId += 1 ;
153
+ let templateFullName = `template:-undertest-${ templateId } ` as const ;
154
+ ownerToRenderFrom . register ( templateFullName , templateFactoryOrComponent ) ;
155
+ let template = lookupTemplate ( ownerToRenderFrom , templateFullName ) ;
156
+
160
157
let outletState = {
161
158
render : {
162
159
owner, // always use the host app owner for application outlet
@@ -177,7 +174,7 @@ export function render(
177
174
name : 'index' ,
178
175
controller : context ,
179
176
ViewClass : undefined ,
180
- template : templateOrComponent ,
177
+ template,
181
178
outlets : { } ,
182
179
} ,
183
180
outlets : { } ,
0 commit comments