@bespunky/angular-zen
Version:
The Angular tools you always wished were there.
49 lines (48 loc) • 1.74 kB
TypeScript
import { Route, Router } from '@angular/router';
import { UrlLocalizationStrategy, UrlLocalizer, UrlLocalizationService, UrlLocalizationConfig } from '@bespunky/angular-zen/language';
import { UrlReflectionService } from '@bespunky/angular-zen/router-x';
/**
* Configures the testing module with localized routes for testing and language integration services.
* Routes are created by running `createDeeplyNestedRoutes(DeepRouteSegments)`.
* Language integration tools are read from `LanguageConfig`.
*
* The function extracts services from the testbed and returns them in the returned object for quick deconstruction.
*
* @export
* @param {(UrlLocalizationStrategy | UrlLocalizationConfig)} strategyOrConfig The url localization strategy or full config.
* @returns A deconstructable object with ready to use language tools. See intellisense.
*/
export declare function setupUrlLocalizerTest(strategyOrConfig?: UrlLocalizationStrategy | UrlLocalizationConfig): {
localizer: UrlLocalizer;
urlLocalization: UrlLocalizationService;
urlReflection: UrlReflectionService;
router: Router;
};
/**
* Recoursively creates nested routes for the specified segments.
* Each specified segment will be a child route of its previous segment.
* Each created route will support 2 paths:
* 1. The segment name.
* 2. An 'en' path.
*
* #### Example
* Running the function on `['some', 'route']` will result in the following supported routes:
* /
*
* /some
* /some/route
*
* /en/
* /en/some
* /en/some/route
*
* /some/en
* /some/en/route
*
* /some/route/en
*
* @export
* @param {string[]} segments
* @returns {Route}
*/
export declare function createLocalizedDeeplyNestedRoutes(segments: string[]): Route;