@@ -24,12 +24,10 @@ import {
2424 ProviderToken ,
2525 Type ,
2626 ɵflushModuleScopingQueueAsMuchAsPossible as flushModuleScopingQueueAsMuchAsPossible ,
27- ɵgetUnknownElementStrictMode as getUnknownElementStrictMode ,
2827 ɵRender3ComponentFactory as ComponentFactory ,
2928 ɵRender3NgModuleRef as NgModuleRef ,
3029 ɵresetCompiledComponents as resetCompiledComponents ,
3130 ɵsetAllowDuplicateNgModuleIdsForTest as setAllowDuplicateNgModuleIdsForTest ,
32- ɵsetUnknownElementStrictMode as setUnknownElementStrictMode ,
3331 ɵstringify as stringify ,
3432} from '@angular/core' ;
3533
@@ -39,7 +37,7 @@ import {ComponentFixture} from './component_fixture';
3937import { MetadataOverride } from './metadata_override' ;
4038import { R3TestBedCompiler } from './r3_test_bed_compiler' ;
4139import { TestBed } from './test_bed' ;
42- import { ComponentFixtureAutoDetect , ComponentFixtureNoNgZone , ModuleTeardownOptions , TEARDOWN_TESTING_MODULE_ON_DESTROY_DEFAULT , TestBedStatic , TestComponentRenderer , TestEnvironmentOptions , TestModuleMetadata , THROW_ON_UNKNOWN_ELEMENTS_DEFAULT } from './test_bed_common' ;
40+ import { ComponentFixtureAutoDetect , ComponentFixtureNoNgZone , ModuleTeardownOptions , TEARDOWN_TESTING_MODULE_ON_DESTROY_DEFAULT , TestBedStatic , TestComponentRenderer , TestEnvironmentOptions , TestModuleMetadata } from './test_bed_common' ;
4341
4442let _nextRootElementId = 0 ;
4543
@@ -61,30 +59,12 @@ export class TestBedRender3 implements TestBed {
6159 */
6260 private static _environmentTeardownOptions : ModuleTeardownOptions | undefined ;
6361
64- /**
65- * "Error on unknown elements" option that has been configured at the environment level.
66- * Used as a fallback if no instance-level option has been provided.
67- */
68- private static _environmentErrorOnUnknownElementsOption : boolean | undefined ;
69-
7062 /**
7163 * Teardown options that have been configured at the `TestBed` instance level.
72- * These options take precedence over the environment -level ones.
64+ * These options take precedence over the environemnt -level ones.
7365 */
7466 private _instanceTeardownOptions : ModuleTeardownOptions | undefined ;
7567
76- /**
77- * "Error on unknown elements" option that has been configured at the `TestBed` instance level.
78- * This option takes precedence over the environment-level one.
79- */
80- private _instanceErrorOnUnknownElementsOption : boolean | undefined ;
81-
82- /**
83- * Stores the previous "Error on unknown elements" option value,
84- * allowing to restore it in the reset testing module logic.
85- */
86- private _previousErrorOnUnknownElementsOption : boolean | undefined ;
87-
8868 /**
8969 * Initialize the environment for testing with a compiler factory, a PlatformRef, and an
9070 * angular module. These are common to every test in the suite.
@@ -257,8 +237,6 @@ export class TestBedRender3 implements TestBed {
257237
258238 TestBedRender3 . _environmentTeardownOptions = options ?. teardown ;
259239
260- TestBedRender3 . _environmentErrorOnUnknownElementsOption = options ?. errorOnUnknownElements ;
261-
262240 this . platform = platform ;
263241 this . ngModule = ngModule ;
264242 this . _compiler = new R3TestBedCompiler ( this . platform , this . ngModule ) ;
@@ -291,9 +269,6 @@ export class TestBedRender3 implements TestBed {
291269 this . compiler . restoreOriginalState ( ) ;
292270 }
293271 this . _compiler = new R3TestBedCompiler ( this . platform , this . ngModule ) ;
294- // Restore the previous value of the "error on unknown elements" option
295- setUnknownElementStrictMode (
296- this . _previousErrorOnUnknownElementsOption ?? THROW_ON_UNKNOWN_ELEMENTS_DEFAULT ) ;
297272
298273 // We have to chain a couple of try/finally blocks, because each step can
299274 // throw errors and we don't want it to interrupt the next step and we also
@@ -308,7 +283,6 @@ export class TestBedRender3 implements TestBed {
308283 } finally {
309284 this . _testModuleRef = null ;
310285 this . _instanceTeardownOptions = undefined ;
311- this . _instanceErrorOnUnknownElementsOption = undefined ;
312286 }
313287 }
314288 }
@@ -332,14 +306,9 @@ export class TestBedRender3 implements TestBed {
332306 // description for additional info.
333307 this . checkGlobalCompilationFinished ( ) ;
334308
335- // Always re-assign the options, even if they're undefined.
336- // This ensures that we don't carry them between tests.
309+ // Always re-assign the teardown options, even if they're undefined.
310+ // This ensures that we don't carry the options between tests.
337311 this . _instanceTeardownOptions = moduleDef . teardown ;
338- this . _instanceErrorOnUnknownElementsOption = moduleDef . errorOnUnknownElements ;
339- // Store the current value of the strict mode option,
340- // so we can restore it later
341- this . _previousErrorOnUnknownElementsOption = getUnknownElementStrictMode ( ) ;
342- setUnknownElementStrictMode ( this . shouldThrowErrorOnUnknownElements ( ) ) ;
343312 this . compiler . configureTestingModule ( moduleDef ) ;
344313 }
345314
@@ -512,7 +481,7 @@ export class TestBedRender3 implements TestBed {
512481 }
513482 }
514483
515- shouldRethrowTeardownErrors ( ) : boolean {
484+ shouldRethrowTeardownErrors ( ) {
516485 const instanceOptions = this . _instanceTeardownOptions ;
517486 const environmentOptions = TestBedRender3 . _environmentTeardownOptions ;
518487
@@ -526,13 +495,6 @@ export class TestBedRender3 implements TestBed {
526495 this . shouldTearDownTestingModule ( ) ;
527496 }
528497
529- shouldThrowErrorOnUnknownElements ( ) : boolean {
530- // Check if a configuration has been provided to throw when an unknown element is found
531- return this . _instanceErrorOnUnknownElementsOption ??
532- TestBedRender3 . _environmentErrorOnUnknownElementsOption ??
533- THROW_ON_UNKNOWN_ELEMENTS_DEFAULT ;
534- }
535-
536498 shouldTearDownTestingModule ( ) : boolean {
537499 return this . _instanceTeardownOptions ?. destroyAfterEach ??
538500 TestBedRender3 . _environmentTeardownOptions ?. destroyAfterEach ??
0 commit comments