blob: 6e5a1e95bf9fcb0ee8058ce2c367f9f09d493540 [file] [log] [blame]
{"version":3,"sources":["packages/router/router-testing.umd.js"],"names":["global","factory","exports","module","require","define","amd","self","ng","router","testing","common","core","this","__decorate","decorators","target","key","desc","d","c","arguments","length","r","Object","getOwnPropertyDescriptor","Reflect","decorate","i","defineProperty","__metadata","metadataKey","metadataValue","metadata","SpyNgModuleFactoryLoader","compiler","_stubbedModules","prototype","get","set","modules","e_1","_a","res","_b","__values","o","m","Symbol","iterator","call","next","value","done","keys","_c","t","compileModuleAsync","e_1_1","error","return","enumerable","configurable","load","path","Promise","reject","Error","Injectable","Compiler","setupTestingRouter","urlSerializer","contexts","location","loader","injector","routes","opts","urlHandlingStrategy","router$1","Router","ɵflatten","isUrlHandlingStrategy","malformedUriErrorHandler","paramsInheritanceStrategy","RouterTestingModule","RouterTestingModule_1","withRoutes","config","ngModule","providers","provideRoutes","provide","ROUTER_CONFIGURATION","useValue","NgModule","RouterModule","ɵROUTER_PROVIDERS","Location","useClass","SpyLocation","LocationStrategy","MockLocationStrategy","NgModuleFactoryLoader","useFactory","deps","UrlSerializer","ChildrenOutletContexts","Injector","ROUTES","UrlHandlingStrategy","Optional","PreloadingStrategy","useExisting","NoPreloading"],"mappings":";;;;;CAMC,SAAUA,EAAQC,GACI,iBAAZC,SAA0C,oBAAXC,OAAyBF,EAAQC,QAASE,QAAQ,mBAAoBA,QAAQ,2BAA4BA,QAAQ,iBAAkBA,QAAQ,oBAChK,mBAAXC,QAAyBA,OAAOC,IAAMD,OAAO,0BAA2B,CAAC,UAAW,kBAAmB,0BAA2B,gBAAiB,mBAAoBJ,GACpJA,IAAzBD,EAASA,GAAUO,MAAsBC,GAAKR,EAAOQ,IAAM,GAAIR,EAAOQ,GAAGC,OAAST,EAAOQ,GAAGC,QAAU,GAAIT,EAAOQ,GAAGC,OAAOC,QAAU,IAAKV,EAAOQ,GAAGG,OAAQX,EAAOQ,GAAGG,OAAOD,QAASV,EAAOQ,GAAGI,K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nF,EAAOoF,qBAAsBC,SAAUN,GAAkB,OAK1DF,EAAwBxE,EAAW,CACrDF,EAAKmF,SAAS,CACV7F,QAAS,CAACO,EAAOuF,cACjBN,UAAW,CACPjF,EAAOwF,kBAAmB,CAAEL,QAASjF,EAAOuF,SAAUC,SAAUzF,EAAQ0F,aACxE,CAAER,QAASjF,EAAO0F,iBAAkBF,SAAUzF,EAAQ4F,sBACtD,CAAEV,QAAShF,EAAK2F,sBAAuBJ,SAAUjE,GAA4B,CACzE0D,QAASnF,EAAOuE,OAChBwB,WAAYlC,EACZmC,KAAM,CACFhG,EAAOiG,cAAejG,EAAOkG,uBAAwBhG,EAAOuF,SAAUtF,EAAK2F,sBAAuB3F,EAAKyD,SAAUzD,EAAKgG,SACtHnG,EAAOoG,OAAQpG,EAAOoF,qBAAsB,CAACpF,EAAOqG,oBAAqB,IAAIlG,EAAKmG,YAG1F,CAAEnB,QAASnF,EAAOuG,mBAAoBC,YAAaxG,EAAOyG,cAAgBzG,EAAOkF,cAAc,QAGxGN,GA/BiC;;;;;;;;;;;;;;;;;;;;;OAgExCnF,EAAQgC,yBAA2BA,EACnChC,EAAQoE,mBAAqBA,EAC7BpE,EAAQmF,oBAAsBA,EAE9B7D,OAAOK,eAAe3B,EAAS,aAAc,CAAEkD,OAAO","sourcesContent":["/**\n * @license Angular v8.1.1\n * (c) 2010-2019 Google LLC. https://angular.io/\n * License: MIT\n */\n\n(function (global, factory) {\n typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/common'), require('@angular/common/testing'), require('@angular/core'), require('@angular/router')) :\n typeof define === 'function' && define.amd ? define('@angular/router/testing', ['exports', '@angular/common', '@angular/common/testing', '@angular/core', '@angular/router'], factory) :\n (global = global || self, factory((global.ng = global.ng || {}, global.ng.router = global.ng.router || {}, global.ng.router.testing = {}), global.ng.common, global.ng.common.testing, global.ng.core, global.ng.router));\n}(this, function (exports, common, testing, core, router) { 'use strict';\n\n /*! *****************************************************************************\r\n Copyright (c) Microsoft Corporation. All rights reserved.\r\n Licensed under the Apache License, Version 2.0 (the \"License\"); you may not use\r\n this file except in compliance with the License. You may obtain a copy of the\r\n License at http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\n KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED\r\n WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,\r\n MERCHANTABLITY OR NON-INFRINGEMENT.\r\n\r\n See the Apache Version 2.0 License for specific language governing permissions\r\n and limitations under the License.\r\n ***************************************************************************** */\r\n\r\n function __decorate(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n }\r\n\r\n function __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n }\r\n\r\n function __values(o) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator], i = 0;\r\n if (m) return m.call(o);\r\n return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n }\n\n /**\n * @license\n * Copyright Google Inc. 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.io/license\n */\n /**\n * @description\n *\n * Allows to simulate the loading of ng modules in tests.\n *\n * ```\n * const loader = TestBed.get(NgModuleFactoryLoader);\n *\n * @Component({template: 'lazy-loaded'})\n * class LazyLoadedComponent {}\n * @NgModule({\n * declarations: [LazyLoadedComponent],\n * imports: [RouterModule.forChild([{path: 'loaded', component: LazyLoadedComponent}])]\n * })\n *\n * class LoadedModule {}\n *\n * // sets up stubbedModules\n * loader.stubbedModules = {lazyModule: LoadedModule};\n *\n * router.resetConfig([\n * {path: 'lazy', loadChildren: 'lazyModule'},\n * ]);\n *\n * router.navigateByUrl('/lazy/loaded');\n * ```\n *\n * @publicApi\n */\n var SpyNgModuleFactoryLoader = /** @class */ (function () {\n function SpyNgModuleFactoryLoader(compiler) {\n this.compiler = compiler;\n /**\n * @docsNotRequired\n */\n this._stubbedModules = {};\n }\n Object.defineProperty(SpyNgModuleFactoryLoader.prototype, \"stubbedModules\", {\n /**\n * @docsNotRequired\n */\n get: function () { return this._stubbedModules; },\n /**\n * @docsNotRequired\n */\n set: function (modules) {\n var e_1, _a;\n var res = {};\n try {\n for (var _b = __values(Object.keys(modules)), _c = _b.next(); !_c.done; _c = _b.next()) {\n var t = _c.value;\n res[t] = this.compiler.compileModuleAsync(modules[t]);\n }\n }\n catch (e_1_1) { e_1 = { error: e_1_1 }; }\n finally {\n try {\n if (_c && !_c.done && (_a = _b.return)) _a.call(_b);\n }\n finally { if (e_1) throw e_1.error; }\n }\n this._stubbedModules = res;\n },\n enumerable: true,\n configurable: true\n });\n SpyNgModuleFactoryLoader.prototype.load = function (path) {\n if (this._stubbedModules[path]) {\n return this._stubbedModules[path];\n }\n else {\n return Promise.reject(new Error(\"Cannot find module \" + path));\n }\n };\n SpyNgModuleFactoryLoader = __decorate([\n core.Injectable(),\n __metadata(\"design:paramtypes\", [core.Compiler])\n ], SpyNgModuleFactoryLoader);\n return SpyNgModuleFactoryLoader;\n }());\n function isUrlHandlingStrategy(opts) {\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 /**\n * Router setup factory function used for testing.\n *\n * @publicApi\n */\n function setupTestingRouter(urlSerializer, contexts, location, loader, compiler, injector, routes, opts, urlHandlingStrategy) {\n var router$1 = new router.Router(null, urlSerializer, contexts, location, injector, loader, compiler, router.ɵflatten(routes));\n if (opts) {\n // Handle deprecated argument ordering.\n if (isUrlHandlingStrategy(opts)) {\n router$1.urlHandlingStrategy = opts;\n }\n else {\n // Handle ExtraOptions\n if (opts.malformedUriErrorHandler) {\n router$1.malformedUriErrorHandler = opts.malformedUriErrorHandler;\n }\n if (opts.paramsInheritanceStrategy) {\n router$1.paramsInheritanceStrategy = opts.paramsInheritanceStrategy;\n }\n }\n }\n if (urlHandlingStrategy) {\n router$1.urlHandlingStrategy = urlHandlingStrategy;\n }\n return router$1;\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`, `LocationStrategy`, and {@link\n * NgModuleFactoryLoader}.\n *\n * @usageNotes\n * ### Example\n *\n * ```\n * beforeEach(() => {\n * TestBed.configureTestModule({\n * imports: [\n * RouterTestingModule.withRoutes(\n * [{path: '', component: BlankCmp}, {path: 'simple', component: SimpleCmp}]\n * )\n * ]\n * });\n * });\n * ```\n *\n * @publicApi\n */\n var RouterTestingModule = /** @class */ (function () {\n function RouterTestingModule() {\n }\n RouterTestingModule_1 = RouterTestingModule;\n RouterTestingModule.withRoutes = function (routes, config) {\n return {\n ngModule: RouterTestingModule_1,\n providers: [\n router.provideRoutes(routes),\n { provide: router.ROUTER_CONFIGURATION, useValue: config ? config : {} },\n ]\n };\n };\n var RouterTestingModule_1;\n RouterTestingModule = RouterTestingModule_1 = __decorate([\n core.NgModule({\n exports: [router.RouterModule],\n providers: [\n router.ɵROUTER_PROVIDERS, { provide: common.Location, useClass: testing.SpyLocation },\n { provide: common.LocationStrategy, useClass: testing.MockLocationStrategy },\n { provide: core.NgModuleFactoryLoader, useClass: SpyNgModuleFactoryLoader }, {\n provide: router.Router,\n useFactory: setupTestingRouter,\n deps: [\n router.UrlSerializer, router.ChildrenOutletContexts, common.Location, core.NgModuleFactoryLoader, core.Compiler, core.Injector,\n router.ROUTES, router.ROUTER_CONFIGURATION, [router.UrlHandlingStrategy, new core.Optional()]\n ]\n },\n { provide: router.PreloadingStrategy, useExisting: router.NoPreloading }, router.provideRoutes([])\n ]\n })\n ], RouterTestingModule);\n return RouterTestingModule;\n }());\n\n /**\n * @license\n * Copyright Google Inc. 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.io/license\n */\n\n /**\n * @license\n * Copyright Google Inc. 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.io/license\n */\n // This file only reexports content of the `src` folder. Keep it that way.\n\n /**\n * @license\n * Copyright Google Inc. 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.io/license\n */\n\n /**\n * Generated bundle index. Do not edit.\n */\n\n exports.SpyNgModuleFactoryLoader = SpyNgModuleFactoryLoader;\n exports.setupTestingRouter = setupTestingRouter;\n exports.RouterTestingModule = RouterTestingModule;\n\n Object.defineProperty(exports, '__esModule', { value: true });\n\n}));\n//# sourceMappingURL=router-testing.umd.js.map\n"]}