1
1
import { Type , DebugElement } from '@angular/core' ;
2
- import { ComponentFixture } from '@angular/core/testing' ;
2
+ import { ComponentFixture , TestBed } from '@angular/core/testing' ;
3
3
import { Routes } from '@angular/router' ;
4
4
import { BoundFunction , Queries , queries , Config as dtlConfig , PrettyDOMOptions } from '@testing-library/dom' ;
5
5
@@ -74,7 +74,7 @@ export interface RenderComponentOptions<ComponentType, Q extends Queries = typeo
74
74
* true
75
75
*
76
76
* @example
77
- * const component = await render(AppComponent, {
77
+ * await render(AppComponent, {
78
78
* autoDetectChanges: false
79
79
* })
80
80
*/
@@ -87,7 +87,7 @@ export interface RenderComponentOptions<ComponentType, Q extends Queries = typeo
87
87
* true
88
88
*
89
89
* @example
90
- * const component = await render(AppComponent, {
90
+ * await render(AppComponent, {
91
91
* detectChangesOnRender: false
92
92
* })
93
93
*/
@@ -103,7 +103,7 @@ export interface RenderComponentOptions<ComponentType, Q extends Queries = typeo
103
103
* []
104
104
*
105
105
* @example
106
- * const component = await render(AppComponent, {
106
+ * await render(AppComponent, {
107
107
* declarations: [ CustomerDetailComponent, ButtonComponent ]
108
108
* })
109
109
*/
@@ -118,7 +118,7 @@ export interface RenderComponentOptions<ComponentType, Q extends Queries = typeo
118
118
* []
119
119
*
120
120
* @example
121
- * const component = await render(AppComponent, {
121
+ * await render(AppComponent, {
122
122
* providers: [
123
123
* CustomersService,
124
124
* {
@@ -140,7 +140,7 @@ export interface RenderComponentOptions<ComponentType, Q extends Queries = typeo
140
140
* `[NoopAnimationsModule]`
141
141
*
142
142
* @example
143
- * const component = await render(AppComponent, {
143
+ * await render(AppComponent, {
144
144
* imports: [
145
145
* AppSharedModule,
146
146
* MaterialModule,
@@ -159,7 +159,7 @@ export interface RenderComponentOptions<ComponentType, Q extends Queries = typeo
159
159
* []
160
160
*
161
161
* @example
162
- * const component = await render(AppComponent, {
162
+ * await render(AppComponent, {
163
163
* schemas: [
164
164
* NO_ERRORS_SCHEMA,
165
165
* ]
@@ -174,7 +174,7 @@ export interface RenderComponentOptions<ComponentType, Q extends Queries = typeo
174
174
* {}
175
175
*
176
176
* @example
177
- * const component = await render(AppComponent, {
177
+ * await render(AppComponent, {
178
178
* componentProperties: {
179
179
* counterValue: 10,
180
180
* send: (value) => { ... }
@@ -190,7 +190,7 @@ export interface RenderComponentOptions<ComponentType, Q extends Queries = typeo
190
190
* {}
191
191
*
192
192
* @example
193
- * const component = await render(AppComponent, {
193
+ * await render(AppComponent, {
194
194
* componentInputs: {
195
195
* counterValue: 10
196
196
* }
@@ -206,7 +206,7 @@ export interface RenderComponentOptions<ComponentType, Q extends Queries = typeo
206
206
*
207
207
* @example
208
208
* const sendValue = (value) => { ... }
209
- * const component = await render(AppComponent, {
209
+ * await render(AppComponent, {
210
210
* componentOutputs: {
211
211
* send: {
212
212
* emit: sendValue
@@ -225,7 +225,7 @@ export interface RenderComponentOptions<ComponentType, Q extends Queries = typeo
225
225
* []
226
226
*
227
227
* @example
228
- * const component = await render(AppComponent, {
228
+ * await render(AppComponent, {
229
229
* componentProviders: [
230
230
* AppComponentService
231
231
* ]
@@ -259,7 +259,7 @@ export interface RenderComponentOptions<ComponentType, Q extends Queries = typeo
259
259
* undefined
260
260
*
261
261
* @example
262
- * const component = await render(AppComponent, {
262
+ * await render(AppComponent, {
263
263
* componentImports: [
264
264
* MockChildComponent
265
265
* ]
@@ -277,7 +277,7 @@ export interface RenderComponentOptions<ComponentType, Q extends Queries = typeo
277
277
* import * as customQueries from 'custom-queries'
278
278
* import { queries } from '@testing-library/angular'
279
279
*
280
- * const component = await render(AppComponent, {
280
+ * await render(AppComponent, {
281
281
* queries: { ...queries, ...customQueries }
282
282
* })
283
283
*/
@@ -291,7 +291,7 @@ export interface RenderComponentOptions<ComponentType, Q extends Queries = typeo
291
291
* false
292
292
*
293
293
* @example
294
- * const component = await render(AppComponent, {
294
+ * await render(AppComponent, {
295
295
* imports: [AppModule], // a module that includes AppComponent
296
296
* excludeComponentDeclaration: true
297
297
* })
@@ -304,7 +304,7 @@ export interface RenderComponentOptions<ComponentType, Q extends Queries = typeo
304
304
* For more info see https://angular.io/api/router/Routes.
305
305
*
306
306
* @example
307
- * const component = await render(AppComponent, {
307
+ * await render(AppComponent, {
308
308
* declarations: [ChildComponent],
309
309
* routes: [
310
310
* {
@@ -326,7 +326,7 @@ export interface RenderComponentOptions<ComponentType, Q extends Queries = typeo
326
326
* Specifies which route should be initially navigated to
327
327
*
328
328
* @example
329
- * const component = await render(AppComponent, {
329
+ * await render(AppComponent, {
330
330
* initialRoute: 'myroute',
331
331
* routes: [
332
332
* { path: '', component: HomeComponent },
@@ -344,11 +344,25 @@ export interface RenderComponentOptions<ComponentType, Q extends Queries = typeo
344
344
* `false`
345
345
*
346
346
* @example
347
- * const component = await render(AppComponent, {
347
+ * await render(AppComponent, {
348
348
* removeAngularAttributes: true
349
349
* })
350
350
*/
351
351
removeAngularAttributes ?: boolean ;
352
+
353
+ /**
354
+ * @description
355
+ * Callback to configure the testbed before the compilation.
356
+ *
357
+ * @default
358
+ * () => {}
359
+ *
360
+ * @example
361
+ * await render(AppComponent, {
362
+ * configureTestBed: (testBed) => { }
363
+ * })
364
+ */
365
+ configureTestBed ?: ( testbed : TestBed ) => void ;
352
366
}
353
367
354
368
export interface ComponentOverride < T > {
@@ -368,7 +382,7 @@ export interface RenderTemplateOptions<WrapperType, Properties extends object =
368
382
* `WrapperComponent`, an empty component that strips the `ng-version` attribute
369
383
*
370
384
* @example
371
- * const component = await render(`<div spoiler message='SPOILER'></div>`, {
385
+ * await render(`<div spoiler message='SPOILER'></div>`, {
372
386
* declarations: [SpoilerDirective]
373
387
* wrapper: CustomWrapperComponent
374
388
* })
0 commit comments