@skyux/router 12.0.0-alpha.14 → 12.0.0-alpha.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -90,7 +90,7 @@ class SkyHrefTestingModule {
|
|
|
90
90
|
SkyHrefResolverMockService,
|
|
91
91
|
{
|
|
92
92
|
provide: SkyHrefResolverService,
|
|
93
|
-
|
|
93
|
+
useExisting: SkyHrefResolverMockService,
|
|
94
94
|
},
|
|
95
95
|
{
|
|
96
96
|
provide: MockUserHasAccess,
|
|
@@ -106,7 +106,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.1", ngImpor
|
|
|
106
106
|
SkyHrefResolverMockService,
|
|
107
107
|
{
|
|
108
108
|
provide: SkyHrefResolverService,
|
|
109
|
-
|
|
109
|
+
useExisting: SkyHrefResolverMockService,
|
|
110
110
|
},
|
|
111
111
|
{
|
|
112
112
|
provide: MockUserHasAccess,
|
|
@@ -116,9 +116,27 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.1", ngImpor
|
|
|
116
116
|
}]
|
|
117
117
|
}] });
|
|
118
118
|
|
|
119
|
+
/**
|
|
120
|
+
* Provides testing services for the `SkyHref` directive and route resolver.
|
|
121
|
+
* @param options Set whether the user has access to the route.
|
|
122
|
+
*/
|
|
123
|
+
function provideHrefTesting(options) {
|
|
124
|
+
return [
|
|
125
|
+
SkyHrefResolverMockService,
|
|
126
|
+
{
|
|
127
|
+
provide: SkyHrefResolverService,
|
|
128
|
+
useExisting: SkyHrefResolverMockService,
|
|
129
|
+
},
|
|
130
|
+
{
|
|
131
|
+
provide: MockUserHasAccess,
|
|
132
|
+
useValue: !!options?.userHasAccess,
|
|
133
|
+
},
|
|
134
|
+
];
|
|
135
|
+
}
|
|
136
|
+
|
|
119
137
|
/**
|
|
120
138
|
* Generated bundle index. Do not edit.
|
|
121
139
|
*/
|
|
122
140
|
|
|
123
|
-
export { SkyHrefHarness, SkyHrefTestingModule };
|
|
141
|
+
export { SkyHrefHarness, SkyHrefTestingModule, provideHrefTesting };
|
|
124
142
|
//# sourceMappingURL=skyux-router-testing.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"skyux-router-testing.mjs","sources":["../../../../../libs/components/router/testing/src/modules/href/href-harness.ts","../../../../../libs/components/router/testing/src/modules/href/href-resolver-mock.service.ts","../../../../../libs/components/router/testing/src/modules/href/href-testing.module.ts","../../../../../libs/components/router/testing/src/skyux-router-testing.ts"],"sourcesContent":["import { HarnessPredicate } from '@angular/cdk/testing';\nimport { SkyComponentHarness } from '@skyux/core/testing';\n\nimport { SkyHrefHarnessFilters } from './href-harness-filters';\n\n/**\n * Allows interaction with a SkyHref directive during testing.\n */\nexport class SkyHrefHarness extends SkyComponentHarness {\n /**\n * @internal\n */\n public static hostSelector = '.sky-href';\n\n /**\n * Gets a `HarnessPredicate` that can be used to search for a\n * `SkyHrefHarness` that meets certain criteria.\n */\n public static with(\n filters: SkyHrefHarnessFilters,\n ): HarnessPredicate<SkyHrefHarness> {\n return this.getDataSkyIdPredicate(filters);\n }\n\n /**\n * Gets the href attribute of the host element.\n */\n public async getHref(): Promise<string | null> {\n return await (await this.host()).getAttribute('href');\n }\n\n /**\n * Gets the visible text.\n */\n public async getText(): Promise<string> {\n return await this.isVisible().then(async (visible) => {\n if (visible) {\n return await (await this.host()).text();\n }\n return '';\n });\n }\n\n /**\n * Returns true if the text is visible.\n */\n public async isVisible(): Promise<boolean> {\n return await (await this.host())\n .matchesSelector('[hidden]')\n .then((hidden) => !hidden);\n }\n}\n","import { Inject, Injectable, InjectionToken } from '@angular/core';\nimport { SkyHref, SkyHrefResolver } from '@skyux/router';\n\nexport const MockUserHasAccess = new InjectionToken<boolean>(\n 'MockUserHasAccess',\n);\n\n/**\n * @internal\n */\n@Injectable()\nexport class SkyHrefResolverMockService implements SkyHrefResolver {\n constructor(@Inject(MockUserHasAccess) private userHasAccess: boolean) {}\n\n public resolveHref(param: { url: string }): Promise<SkyHref> {\n return Promise.resolve({\n url: param.url,\n userHasAccess: this.userHasAccess,\n });\n }\n}\n","import { ModuleWithProviders, NgModule } from '@angular/core';\nimport { SkyHrefModule, SkyHrefResolverService } from '@skyux/router';\n\nimport {\n MockUserHasAccess,\n SkyHrefResolverMockService,\n} from './href-resolver-mock.service';\n\n/**\n * Testing module for the `SkyHref` directive and route resolver.\n */\n@NgModule({\n exports: [SkyHrefModule],\n providers: [\n SkyHrefResolverMockService,\n {\n provide: SkyHrefResolverService,\n
|
|
1
|
+
{"version":3,"file":"skyux-router-testing.mjs","sources":["../../../../../libs/components/router/testing/src/modules/href/href-harness.ts","../../../../../libs/components/router/testing/src/modules/href/href-resolver-mock.service.ts","../../../../../libs/components/router/testing/src/modules/href/href-testing.module.ts","../../../../../libs/components/router/testing/src/modules/href/provide-href-testing.ts","../../../../../libs/components/router/testing/src/skyux-router-testing.ts"],"sourcesContent":["import { HarnessPredicate } from '@angular/cdk/testing';\nimport { SkyComponentHarness } from '@skyux/core/testing';\n\nimport { SkyHrefHarnessFilters } from './href-harness-filters';\n\n/**\n * Allows interaction with a SkyHref directive during testing.\n */\nexport class SkyHrefHarness extends SkyComponentHarness {\n /**\n * @internal\n */\n public static hostSelector = '.sky-href';\n\n /**\n * Gets a `HarnessPredicate` that can be used to search for a\n * `SkyHrefHarness` that meets certain criteria.\n */\n public static with(\n filters: SkyHrefHarnessFilters,\n ): HarnessPredicate<SkyHrefHarness> {\n return this.getDataSkyIdPredicate(filters);\n }\n\n /**\n * Gets the href attribute of the host element.\n */\n public async getHref(): Promise<string | null> {\n return await (await this.host()).getAttribute('href');\n }\n\n /**\n * Gets the visible text.\n */\n public async getText(): Promise<string> {\n return await this.isVisible().then(async (visible) => {\n if (visible) {\n return await (await this.host()).text();\n }\n return '';\n });\n }\n\n /**\n * Returns true if the text is visible.\n */\n public async isVisible(): Promise<boolean> {\n return await (await this.host())\n .matchesSelector('[hidden]')\n .then((hidden) => !hidden);\n }\n}\n","import { Inject, Injectable, InjectionToken } from '@angular/core';\nimport { SkyHref, SkyHrefResolver } from '@skyux/router';\n\nexport const MockUserHasAccess = new InjectionToken<boolean>(\n 'MockUserHasAccess',\n);\n\n/**\n * @internal\n */\n@Injectable()\nexport class SkyHrefResolverMockService implements SkyHrefResolver {\n constructor(@Inject(MockUserHasAccess) private userHasAccess: boolean) {}\n\n public resolveHref(param: { url: string }): Promise<SkyHref> {\n return Promise.resolve({\n url: param.url,\n userHasAccess: this.userHasAccess,\n });\n }\n}\n","import { ModuleWithProviders, NgModule } from '@angular/core';\nimport { SkyHrefModule, SkyHrefResolverService } from '@skyux/router';\n\nimport {\n MockUserHasAccess,\n SkyHrefResolverMockService,\n} from './href-resolver-mock.service';\n\n/**\n * Testing module for the `SkyHref` directive and route resolver.\n */\n@NgModule({\n exports: [SkyHrefModule],\n providers: [\n SkyHrefResolverMockService,\n {\n provide: SkyHrefResolverService,\n useExisting: SkyHrefResolverMockService,\n },\n {\n provide: MockUserHasAccess,\n useValue: true,\n },\n ],\n})\nexport class SkyHrefTestingModule {\n public static with(options: {\n userHasAccess: boolean;\n }): ModuleWithProviders<SkyHrefTestingModule> {\n return {\n ngModule: SkyHrefTestingModule,\n providers: [\n {\n provide: MockUserHasAccess,\n useValue: options.userHasAccess,\n },\n ],\n };\n }\n}\n","import { Provider } from '@angular/core';\nimport { SkyHrefResolverService } from '@skyux/router';\n\nimport {\n MockUserHasAccess,\n SkyHrefResolverMockService,\n} from './href-resolver-mock.service';\n\n/**\n * Provides testing services for the `SkyHref` directive and route resolver.\n * @param options Set whether the user has access to the route.\n */\nexport function provideHrefTesting(options?: {\n userHasAccess: boolean;\n}): Provider[] {\n return [\n SkyHrefResolverMockService,\n {\n provide: SkyHrefResolverService,\n useExisting: SkyHrefResolverMockService,\n },\n {\n provide: MockUserHasAccess,\n useValue: !!options?.userHasAccess,\n },\n ];\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-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,EAAE,IAAI;AACf,aAAA;AACF,SAAA,EAAA,OAAA,EAAA,CAXS,aAAa,CAAA,EAAA,CAAA,CAAA;;2FAaZ,oBAAoB,EAAA,UAAA,EAAA,CAAA;kBAdhC,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;oBACR,OAAO,EAAE,CAAC,aAAa,CAAC;AACxB,oBAAA,SAAS,EAAE;wBACT,0BAA0B;AAC1B,wBAAA;AACE,4BAAA,OAAO,EAAE,sBAAsB;AAC/B,4BAAA,WAAW,EAAE,0BAA0B;AACxC,yBAAA;AACD,wBAAA;AACE,4BAAA,OAAO,EAAE,iBAAiB;AAC1B,4BAAA,QAAQ,EAAE,IAAI;AACf,yBAAA;AACF,qBAAA;AACF,iBAAA;;;AChBD;;;AAGG;AACG,SAAU,kBAAkB,CAAC,OAElC,EAAA;IACC,OAAO;QACL,0BAA0B;AAC1B,QAAA;AACE,YAAA,OAAO,EAAE,sBAAsB;AAC/B,YAAA,WAAW,EAAE,0BAA0B;AACxC,SAAA;AACD,QAAA;AACE,YAAA,OAAO,EAAE,iBAAiB;AAC1B,YAAA,QAAQ,EAAE,CAAC,CAAC,OAAO,EAAE,aAAa;AACnC,SAAA;KACF;AACH;;AC1BA;;AAEG;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@skyux/router",
|
|
3
|
-
"version": "12.0.0-alpha.
|
|
3
|
+
"version": "12.0.0-alpha.15",
|
|
4
4
|
"author": "Blackbaud, Inc.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"blackbaud",
|
|
@@ -20,8 +20,8 @@
|
|
|
20
20
|
"@angular/common": "^19.2.1",
|
|
21
21
|
"@angular/core": "^19.2.1",
|
|
22
22
|
"@angular/router": "^19.2.1",
|
|
23
|
-
"@skyux/config": "12.0.0-alpha.
|
|
24
|
-
"@skyux/core": "12.0.0-alpha.
|
|
23
|
+
"@skyux/config": "12.0.0-alpha.15",
|
|
24
|
+
"@skyux/core": "12.0.0-alpha.15"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
27
|
"tslib": "^2.8.1"
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Provider } from '@angular/core';
|
|
2
|
+
/**
|
|
3
|
+
* Provides testing services for the `SkyHref` directive and route resolver.
|
|
4
|
+
* @param options Set whether the user has access to the route.
|
|
5
|
+
*/
|
|
6
|
+
export declare function provideHrefTesting(options?: {
|
|
7
|
+
userHasAccess: boolean;
|
|
8
|
+
}): Provider[];
|
package/testing/public-api.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
export { SkyHrefHarness } from './modules/href/href-harness';
|
|
2
2
|
export { SkyHrefHarnessFilters } from './modules/href/href-harness-filters';
|
|
3
3
|
export { SkyHrefTestingModule } from './modules/href/href-testing.module';
|
|
4
|
+
export { provideHrefTesting } from './modules/href/provide-href-testing';
|