UNPKG

@bespunky/angular-zen

Version:

The Angular tools you always wished were there.

1 lines 4.12 kB
{"version":3,"file":"bespunky-angular-zen-router-x-testing.mjs","sources":["../../../../libs/angular-zen/router-x/testing/src/utils/routes.ts","../../../../libs/angular-zen/router-x/testing/src/utils/setup.ts","../../../../libs/angular-zen/router-x/testing/src/bespunky-angular-zen-router-x-testing.ts"],"sourcesContent":["/** A multi-level route string for. */\nexport const DeepRoutePath = '/deeply/nested/route/for/testing';\n/**\n * The segments of `DeepRoutePath`. First element will always be '' (empty string) as the route begins with a forward slash.\n * Use `DeepRouteSegmentsNoRoot` for an array of segments without the root ''.\n */\nexport const DeepRouteSegments = ['', 'deeply', 'nested', 'route', 'for', 'testing']; // For some reasone `DeepRoutePath.split('/')` causes a stack overflow when building with --prod.\n/**\n * The segments of `DeepRoutePath` without the root route (the '' route).\n * Use `DeepRouteSegments` for an array of segments with the root ''.\n */\nexport const DeepRouteSegmentsNoRoot = DeepRouteSegments.slice(1);\n","import { Component, NgModule } from '@angular/core';\nimport { Route } from '@angular/router';\n\n/**\n * Recoursively creates nested routes for the specified segments.\n * Each specified segment will be a child route of its previous segment.\n * \n * #### Example\n * Running the function on `['some', 'route']` will result in the following supported routes: \n * / \n * \n * /some \n * /some/route \n *\n * @export\n * @param {string[]} segments The route segments from which routes are to be created.\n * @returns {Route} An Angular router module compatible route tree containing all segments as child routes.\n */\nexport function createDeeplyNestedRoutes(segments: string[]): Route\n{\n const parent: Route & { children: Route[] } = { path: segments[0], component: NoopComponent, children: [] };\n\n if (segments.length > 1)\n {\n const nestedChildren = createDeeplyNestedRoutes(segments.slice(1));\n \n // Add the route tree to the node\n parent.children.push(nestedChildren);\n }\n\n return parent;\n}\n\n/**\n * A functionless component.\n * Can be used for setting routes in which the component is not important, but required by the route object.\n *\n * @export\n * @class NoopComponent\n */\n@Component({ selector: 'zen-router-x-noop', template: '<div>noop</div>' }) export class NoopComponent { }\n\n/**\n * A functionless module exporting the functionless `NoopComponent`.\n *\n * @export\n * @class NoopModule\n */\n@NgModule({ declarations: [NoopComponent], exports: [NoopComponent] }) export class NoopModule { }","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;AAAA;AACO,MAAM,aAAa,GAAa,mCAAmC;AAC1E;;;AAGG;AACU,MAAA,iBAAiB,GAAS,CAAC,EAAE,EAAE,QAAQ,EAAE,QAAQ,EAAE,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE;AAC3F;;;AAGG;AACU,MAAA,uBAAuB,GAAG,iBAAiB,CAAC,KAAK,CAAC,CAAC;;ACRhE;;;;;;;;;;;;;;AAcG;AACG,SAAU,wBAAwB,CAAC,QAAkB,EAAA;AAEvD,IAAA,MAAM,MAAM,GAAkC,EAAE,IAAI,EAAE,QAAQ,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,aAAa,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC;AAE5G,IAAA,IAAI,QAAQ,CAAC,MAAM,GAAG,CAAC,EACvB;QACI,MAAM,cAAc,GAAG,wBAAwB,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;;AAGnE,QAAA,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;AACxC,KAAA;AAED,IAAA,OAAO,MAAM,CAAC;AAClB,CAAC;AAED;;;;;;AAMG;MACqF,aAAa,CAAA;;2GAAb,aAAa,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA,CAAA;AAAb,aAAA,CAAA,IAAA,GAAA,EAAA,CAAA,oBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,SAAA,EAAA,IAAA,EAAA,aAAa,yDAA/C,iBAAiB,EAAA,QAAA,EAAA,IAAA,EAAA,CAAA,CAAA;4FAAiB,aAAa,EAAA,UAAA,EAAA,CAAA;kBAApG,SAAS;YAAC,IAAA,EAAA,CAA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