Kargi-Sitesi/node_modules/@angular/router/fesm2022/testing.mjs.map

1 line
16 KiB
Text
Raw Normal View History

2024-11-03 21:30:09 -05:00
{"version":3,"file":"testing.mjs","sources":["../../../../../../packages/router/testing/src/router_testing_module.ts","../../../../../../packages/router/testing/src/router_testing_harness.ts","../../../../../../packages/router/testing/src/testing.ts","../../../../../../packages/router/testing/public_api.ts","../../../../../../packages/router/testing/index.ts","../../../../../../packages/router/testing/testing.ts"],"sourcesContent":["/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport {Location} from '@angular/common';\nimport {provideLocationMocks} from '@angular/common/testing';\nimport {Compiler, inject, Injector, ModuleWithProviders, NgModule} from '@angular/core';\nimport {\n ChildrenOutletContexts,\n ExtraOptions,\n NoPreloading,\n Route,\n Router,\n ROUTER_CONFIGURATION,\n RouteReuseStrategy,\n RouterModule,\n ROUTES,\n Routes,\n TitleStrategy,\n UrlHandlingStrategy,\n UrlSerializer,\n withPreloading,\n ɵROUTER_PROVIDERS as ROUTER_PROVIDERS,\n} from '@angular/router';\n\nfunction isUrlHandlingStrategy(\n opts: ExtraOptions | UrlHandlingStrategy,\n): opts is UrlHandlingStrategy {\n // This property check is needed because UrlHandlingStrategy is an interface and doesn't exist at\n // runtime.\n return 'shouldProcessUrl' in opts;\n}\n\nfunction throwInvalidConfigError(parameter: string): never {\n throw new Error(\n `Parameter ${parameter} does not match the one available in the injector. ` +\n '`setupTestingRouter` is meant to be used as a factory function with dependencies coming from DI.',\n );\n}\n\n/**\n * @description\n *\n * Sets up the router to be used for testing.\n *\n * The modules sets up the router to be used for testing.\n * It provides spy implementations of `Location` and `LocationStrategy`.\n *\n * @usageNotes\n * ### Example\n *\n * ```\n * beforeEach(() => {\n * TestBed.configureTestingModule({\n * imports: [\n * RouterModule.forRoot(\n * [{path: '', component: BlankCmp}, {path: 'simple', component: SimpleCmp}]\n * )\n * ]\n * });\n * });\n * ```\n *\n * @publicApi\n * @deprecated Use `provideRouter` or `RouterModule`/`RouterModule.forRoot` instead.\n * This module was previously used to provide a helpful collection of test fakes,\n * most notably those for `Location` and `LocationStrategy`. These are generally not\n * required anymore, as `MockPlatformLocation` is provided in `TestBed` by default.\n * However, you can use them directly with `provideLocationMocks`.\n */\n@NgModule({\n exports: [RouterModule],\n providers: [\n ROUTER_PROVIDERS,\n provideLocationMocks(),\n withPreloading(NoPreloading).ɵproviders,\n {provide: ROUTES, multi: true, useValue: []},\n ],\n})\nexport class RouterTestingModule {\n static withRoutes(\n routes: Routes,\n config?: ExtraOptions,\n ): ModuleWithProviders<RouterTestingModule> {\n return {\n ngModule: RouterTestingModule,\n providers: [\n {provide: ROUTES, multi: true, useValue: routes},\n {provide: ROUTER_CONFIGURATION, useValue: config ? config : {}},\n ],\n };\n }\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport {Component, DebugElement, Injectable, Type, ViewChild} from '@angular/core';\nimport {ComponentFixture, TestBed} from '@angular/core/testing';\nimport {Router, RouterOutlet, ɵafterNextNavigation as afterNextNavigation} from '@angular/router';\n\n@Injectable({providedIn: 'root'})\nexport class RootFixtureService {\n private fixture?: ComponentFixture<RootCmp>;\n private harness?: RouterTestingHarness;\n\n createHarness(): RouterTestingHarness {\n if (this.harness) {\n throw new Error('Only one harness should be created per test.');\n }\n this.harness = new RouterTestingHarness(t