@o3r/testing 14.4.0-prerelease.8 → 14.5.0-prerelease.0
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.
- package/package.json +37 -23
- package/transloco/index.d.ts +2 -0
- package/transloco/index.d.ts.map +1 -0
- package/transloco/index.js +5 -0
- package/transloco/index.js.map +1 -0
- package/transloco/transloco-mock.d.ts +40 -0
- package/transloco/transloco-mock.d.ts.map +1 -0
- package/transloco/transloco-mock.js +71 -0
- package/transloco/transloco-mock.js.map +1 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@o3r/testing",
|
|
3
|
-
"version": "14.
|
|
3
|
+
"version": "14.5.0-prerelease.0",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -56,6 +56,10 @@
|
|
|
56
56
|
"types": "./localization/index.d.ts",
|
|
57
57
|
"default": "./localization/index.js"
|
|
58
58
|
},
|
|
59
|
+
"./transloco": {
|
|
60
|
+
"types": "./transloco/index.d.ts",
|
|
61
|
+
"default": "./transloco/index.js"
|
|
62
|
+
},
|
|
59
63
|
"./mocks": {
|
|
60
64
|
"types": "./mocks/index.d.ts",
|
|
61
65
|
"default": "./mocks/index.js"
|
|
@@ -96,13 +100,15 @@
|
|
|
96
100
|
"@angular/core": "^21.0.0",
|
|
97
101
|
"@angular/forms": "^21.0.0",
|
|
98
102
|
"@angular/platform-browser": "^21.0.0",
|
|
103
|
+
"@jsverse/transloco": "^8.0.0",
|
|
99
104
|
"@material/slider": "^14.0.0",
|
|
100
105
|
"@ngrx/store": "^21.0.0",
|
|
101
106
|
"@ngx-translate/core": "^15.0.0 || ~16.0.4",
|
|
102
|
-
"@o3r/core": "~14.
|
|
103
|
-
"@o3r/eslint-config": "~14.
|
|
104
|
-
"@o3r/localization": "~14.
|
|
105
|
-
"@o3r/schematics": "~14.
|
|
107
|
+
"@o3r/core": "~14.5.0-prerelease.0",
|
|
108
|
+
"@o3r/eslint-config": "~14.5.0-prerelease.0",
|
|
109
|
+
"@o3r/localization": "~14.5.0-prerelease.0",
|
|
110
|
+
"@o3r/schematics": "~14.5.0-prerelease.0",
|
|
111
|
+
"@o3r/transloco": "~14.5.0-prerelease.0",
|
|
106
112
|
"@playwright/test": "^1.49.0",
|
|
107
113
|
"@schematics/angular": "^21.0.0",
|
|
108
114
|
"eslint": "~9.39.0",
|
|
@@ -129,6 +135,9 @@
|
|
|
129
135
|
"@angular/forms": {
|
|
130
136
|
"optional": true
|
|
131
137
|
},
|
|
138
|
+
"@jsverse/transloco": {
|
|
139
|
+
"optional": true
|
|
140
|
+
},
|
|
132
141
|
"@material/slider": {
|
|
133
142
|
"optional": true
|
|
134
143
|
},
|
|
@@ -150,6 +159,9 @@
|
|
|
150
159
|
"@o3r/schematics": {
|
|
151
160
|
"optional": true
|
|
152
161
|
},
|
|
162
|
+
"@o3r/transloco": {
|
|
163
|
+
"optional": true
|
|
164
|
+
},
|
|
153
165
|
"@playwright/test": {
|
|
154
166
|
"optional": true
|
|
155
167
|
},
|
|
@@ -170,7 +182,7 @@
|
|
|
170
182
|
}
|
|
171
183
|
},
|
|
172
184
|
"dependencies": {
|
|
173
|
-
"@o3r/schematics": "~14.
|
|
185
|
+
"@o3r/schematics": "~14.5.0-prerelease.0",
|
|
174
186
|
"esbuild": "~0.27.0",
|
|
175
187
|
"tslib": "^2.6.2"
|
|
176
188
|
},
|
|
@@ -188,20 +200,22 @@
|
|
|
188
200
|
"@angular/platform-browser": "~21.2.4",
|
|
189
201
|
"@angular/platform-browser-dynamic": "~21.2.4",
|
|
190
202
|
"@babel/core": "~7.29.0",
|
|
191
|
-
"@babel/preset-typescript": "~7.
|
|
203
|
+
"@babel/preset-typescript": "~7.29.0",
|
|
192
204
|
"@compodoc/compodoc": "^1.1.32",
|
|
193
205
|
"@eslint-community/eslint-plugin-eslint-comments": "^4.4.0",
|
|
206
|
+
"@jsverse/transloco": "~8.2.1",
|
|
194
207
|
"@material/slider": "^14.0.0",
|
|
195
208
|
"@ngrx/store": "~21.1.0",
|
|
196
209
|
"@ngx-translate/core": "~16.0.4",
|
|
197
210
|
"@nx/eslint-plugin": "~22.7.0",
|
|
198
211
|
"@nx/jest": "~22.7.0",
|
|
199
|
-
"@o3r/build-helpers": "~14.
|
|
200
|
-
"@o3r/core": "~14.
|
|
201
|
-
"@o3r/eslint-plugin": "~14.
|
|
202
|
-
"@o3r/localization": "~14.
|
|
203
|
-
"@o3r/test-helpers": "~14.
|
|
204
|
-
"@
|
|
212
|
+
"@o3r/build-helpers": "~14.5.0-prerelease.0",
|
|
213
|
+
"@o3r/core": "~14.5.0-prerelease.0",
|
|
214
|
+
"@o3r/eslint-plugin": "~14.5.0-prerelease.0",
|
|
215
|
+
"@o3r/localization": "~14.5.0-prerelease.0",
|
|
216
|
+
"@o3r/test-helpers": "~14.5.0-prerelease.0",
|
|
217
|
+
"@o3r/transloco": "~14.5.0-prerelease.0",
|
|
218
|
+
"@playwright/test": "~1.60.0",
|
|
205
219
|
"@schematics/angular": "~21.2.0",
|
|
206
220
|
"@standard-schema/spec": "~1.1.0",
|
|
207
221
|
"@stylistic/eslint-plugin": "~5.10.0",
|
|
@@ -210,12 +224,12 @@
|
|
|
210
224
|
"@types/node": "~24.12.0",
|
|
211
225
|
"@types/pixelmatch": "^5.2.3",
|
|
212
226
|
"@types/pngjs": "^6.0.0",
|
|
213
|
-
"@typescript-eslint/parser": "~8.
|
|
214
|
-
"angular-eslint": "~21.
|
|
227
|
+
"@typescript-eslint/parser": "~8.60.0",
|
|
228
|
+
"angular-eslint": "~21.4.0",
|
|
215
229
|
"concurrently": "^9.1.0",
|
|
216
230
|
"cpy-cli": "^6.0.0",
|
|
217
231
|
"eslint": "~9.39.0",
|
|
218
|
-
"eslint-import-resolver-node": "~0.
|
|
232
|
+
"eslint-import-resolver-node": "~0.4.0",
|
|
219
233
|
"eslint-import-resolver-typescript": "~4.4.0",
|
|
220
234
|
"eslint-plugin-import": "~2.32.0",
|
|
221
235
|
"eslint-plugin-import-newlines": "~1.4.0",
|
|
@@ -226,11 +240,11 @@
|
|
|
226
240
|
"eslint-plugin-unused-imports": "~4.4.0",
|
|
227
241
|
"globals": "^16.0.0",
|
|
228
242
|
"isomorphic-fetch": "~3.0.0",
|
|
229
|
-
"jest": "~30.
|
|
230
|
-
"jest-environment-jsdom": "~30.
|
|
243
|
+
"jest": "~30.4.0",
|
|
244
|
+
"jest-environment-jsdom": "~30.4.0",
|
|
231
245
|
"jest-junit": "~16.0.0",
|
|
232
246
|
"jest-preset-angular": "~16.1.0",
|
|
233
|
-
"jest-util": "~30.
|
|
247
|
+
"jest-util": "~30.4.0",
|
|
234
248
|
"jsdom": "~27.4.0",
|
|
235
249
|
"jsonc-eslint-parser": "~2.4.0",
|
|
236
250
|
"nx": "~22.7.0",
|
|
@@ -242,15 +256,15 @@
|
|
|
242
256
|
"ts-jest": "~29.4.0",
|
|
243
257
|
"type-fest": "^5.3.1",
|
|
244
258
|
"typescript": "~5.9.2",
|
|
245
|
-
"typescript-eslint": "~8.
|
|
259
|
+
"typescript-eslint": "~8.60.0"
|
|
246
260
|
},
|
|
247
261
|
"generatorDependencies": {
|
|
248
262
|
"@angular-builders/jest": "~21.0.0-beta.1",
|
|
249
263
|
"@types/jest": "~30.0.0",
|
|
250
|
-
"jest": "~30.
|
|
251
|
-
"jest-environment-jsdom": "~30.
|
|
264
|
+
"jest": "~30.4.0",
|
|
265
|
+
"jest-environment-jsdom": "~30.4.0",
|
|
252
266
|
"jest-preset-angular": "~16.1.0",
|
|
253
|
-
"jest-util": "~30.
|
|
267
|
+
"jest-util": "~30.4.0",
|
|
254
268
|
"rimraf": "^6.0.1",
|
|
255
269
|
"ts-jest": "~29.4.0",
|
|
256
270
|
"uuid": "~14.0.0"
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/transloco/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/transloco/index.ts"],"names":[],"mappings":";;;AAAA,2DAAiC","sourcesContent":["export * from './transloco-mock';\n"]}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { EnvironmentProviders, PipeTransform, Provider } from '@angular/core';
|
|
2
|
+
import { LocalizationConfiguration } from '@o3r/transloco';
|
|
3
|
+
/**
|
|
4
|
+
* Mock translations interface to provide to the mock localization provider
|
|
5
|
+
*/
|
|
6
|
+
export interface MockTranslations {
|
|
7
|
+
/** Language code mapped to its translation key-value pairs */
|
|
8
|
+
[lang: string]: {
|
|
9
|
+
/** Translation key mapped to its translated value */
|
|
10
|
+
[key: string]: any;
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Mock pipe for transloco (from \@jsverse/transloco)
|
|
15
|
+
*/
|
|
16
|
+
export declare class TranslocoPipeMock implements PipeTransform {
|
|
17
|
+
/**
|
|
18
|
+
* Transform method for the mock pipe
|
|
19
|
+
* @param args Arguments passed to the pipe
|
|
20
|
+
*/
|
|
21
|
+
transform(...args: any[]): string | undefined;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Mock pipe for o3rTranslate
|
|
25
|
+
*/
|
|
26
|
+
export declare class O3rTranslatePipeMock implements PipeTransform {
|
|
27
|
+
/**
|
|
28
|
+
* Transform method for the mock pipe
|
|
29
|
+
* @param args Arguments passed to the pipe
|
|
30
|
+
*/
|
|
31
|
+
transform(...args: any[]): string | undefined;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Provides mock localization configuration for testing
|
|
35
|
+
* @param localizationConfiguration Localization configuration
|
|
36
|
+
* @param translations Translations to use
|
|
37
|
+
* @returns List of providers for the TestBed
|
|
38
|
+
*/
|
|
39
|
+
export declare function provideLocalizationMock(localizationConfiguration?: Partial<LocalizationConfiguration>, translations?: MockTranslations): (Provider | EnvironmentProviders)[];
|
|
40
|
+
//# sourceMappingURL=transloco-mock.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transloco-mock.d.ts","sourceRoot":"","sources":["../../src/transloco/transloco-mock.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,oBAAoB,EAEpB,aAAa,EACb,QAAQ,EACT,MAAM,eAAe,CAAC;AAIvB,OAAO,EACL,yBAAyB,EAE1B,MAAM,gBAAgB,CAAC;AAcxB;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,8DAA8D;IAC9D,CAAC,IAAI,EAAE,MAAM,GAAG;QACd,qDAAqD;QACrD,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;KACpB,CAAC;CACH;AAED;;GAEG;AACH,qBAIa,iBAAkB,YAAW,aAAa;IACrD;;;OAGG;IACI,SAAS,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,GAAG,MAAM,GAAG,SAAS;CAGrD;AAED;;GAEG;AACH,qBAIa,oBAAqB,YAAW,aAAa;IACxD;;;OAGG;IACI,SAAS,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,GAAG,MAAM,GAAG,SAAS;CAGrD;AAED;;;;;GAKG;AACH,wBAAgB,uBAAuB,CACrC,yBAAyB,GAAE,OAAO,CAAC,yBAAyB,CAAoC,EAChG,YAAY,GAAE,gBAAqB,GAClC,CAAC,QAAQ,GAAG,oBAAoB,CAAC,EAAE,CASrC"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.O3rTranslatePipeMock = exports.TranslocoPipeMock = void 0;
|
|
4
|
+
exports.provideLocalizationMock = provideLocalizationMock;
|
|
5
|
+
const tslib_1 = require("tslib");
|
|
6
|
+
const core_1 = require("@angular/core");
|
|
7
|
+
const transloco_1 = require("@jsverse/transloco");
|
|
8
|
+
const transloco_2 = require("@o3r/transloco");
|
|
9
|
+
const rxjs_1 = require("rxjs");
|
|
10
|
+
/**
|
|
11
|
+
* Default localization configuration for testing
|
|
12
|
+
*/
|
|
13
|
+
const defaultLocalizationConfiguration = {
|
|
14
|
+
supportedLocales: ['en'],
|
|
15
|
+
language: 'en',
|
|
16
|
+
fallbackLanguage: 'en'
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* Mock pipe for transloco (from \@jsverse/transloco)
|
|
20
|
+
*/
|
|
21
|
+
let TranslocoPipeMock = class TranslocoPipeMock {
|
|
22
|
+
/**
|
|
23
|
+
* Transform method for the mock pipe
|
|
24
|
+
* @param args Arguments passed to the pipe
|
|
25
|
+
*/
|
|
26
|
+
transform(...args) {
|
|
27
|
+
return args && args.map((arg) => JSON.stringify(arg)).join(', ');
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
exports.TranslocoPipeMock = TranslocoPipeMock;
|
|
31
|
+
exports.TranslocoPipeMock = TranslocoPipeMock = tslib_1.__decorate([
|
|
32
|
+
(0, core_1.Pipe)({
|
|
33
|
+
name: 'transloco',
|
|
34
|
+
standalone: true
|
|
35
|
+
})
|
|
36
|
+
], TranslocoPipeMock);
|
|
37
|
+
/**
|
|
38
|
+
* Mock pipe for o3rTranslate
|
|
39
|
+
*/
|
|
40
|
+
let O3rTranslatePipeMock = class O3rTranslatePipeMock {
|
|
41
|
+
/**
|
|
42
|
+
* Transform method for the mock pipe
|
|
43
|
+
* @param args Arguments passed to the pipe
|
|
44
|
+
*/
|
|
45
|
+
transform(...args) {
|
|
46
|
+
return args && args.map((arg) => JSON.stringify(arg)).join(', ');
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
exports.O3rTranslatePipeMock = O3rTranslatePipeMock;
|
|
50
|
+
exports.O3rTranslatePipeMock = O3rTranslatePipeMock = tslib_1.__decorate([
|
|
51
|
+
(0, core_1.Pipe)({
|
|
52
|
+
name: 'o3rTranslate',
|
|
53
|
+
standalone: true
|
|
54
|
+
})
|
|
55
|
+
], O3rTranslatePipeMock);
|
|
56
|
+
/**
|
|
57
|
+
* Provides mock localization configuration for testing
|
|
58
|
+
* @param localizationConfiguration Localization configuration
|
|
59
|
+
* @param translations Translations to use
|
|
60
|
+
* @returns List of providers for the TestBed
|
|
61
|
+
*/
|
|
62
|
+
function provideLocalizationMock(localizationConfiguration = defaultLocalizationConfiguration, translations = {}) {
|
|
63
|
+
const providers = [
|
|
64
|
+
{ provide: transloco_1.TRANSLOCO_LOADER, useValue: { getTranslation: (lang) => (0, rxjs_1.of)(translations[lang]) } }
|
|
65
|
+
];
|
|
66
|
+
return [
|
|
67
|
+
(0, transloco_2.provideLocalization)(localizationConfiguration),
|
|
68
|
+
...providers
|
|
69
|
+
];
|
|
70
|
+
}
|
|
71
|
+
//# sourceMappingURL=transloco-mock.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transloco-mock.js","sourceRoot":"","sources":["../../src/transloco/transloco-mock.ts"],"names":[],"mappings":";;;AA6EA,0DAYC;;AAzFD,wCAKuB;AACvB,kDAE4B;AAC5B,8CAGwB;AACxB,+BAEc;AAEd;;GAEG;AACH,MAAM,gCAAgC,GAAG;IACvC,gBAAgB,EAAE,CAAC,IAAI,CAAC;IACxB,QAAQ,EAAE,IAAI;IACd,gBAAgB,EAAE,IAAI;CAC+B,CAAC;AAaxD;;GAEG;AAKI,IAAM,iBAAiB,GAAvB,MAAM,iBAAiB;IAC5B;;;OAGG;IACI,SAAS,CAAC,GAAG,IAAW;QAC7B,OAAO,IAAI,IAAI,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACnE,CAAC;CACF,CAAA;AARY,8CAAiB;4BAAjB,iBAAiB;IAJ7B,IAAA,WAAI,EAAC;QACJ,IAAI,EAAE,WAAW;QACjB,UAAU,EAAE,IAAI;KACjB,CAAC;GACW,iBAAiB,CAQ7B;AAED;;GAEG;AAKI,IAAM,oBAAoB,GAA1B,MAAM,oBAAoB;IAC/B;;;OAGG;IACI,SAAS,CAAC,GAAG,IAAW;QAC7B,OAAO,IAAI,IAAI,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACnE,CAAC;CACF,CAAA;AARY,oDAAoB;+BAApB,oBAAoB;IAJhC,IAAA,WAAI,EAAC;QACJ,IAAI,EAAE,cAAc;QACpB,UAAU,EAAE,IAAI;KACjB,CAAC;GACW,oBAAoB,CAQhC;AAED;;;;;GAKG;AACH,SAAgB,uBAAuB,CACrC,4BAAgE,gCAAgC,EAChG,eAAiC,EAAE;IAEnC,MAAM,SAAS,GAAe;QAC5B,EAAE,OAAO,EAAE,4BAAgB,EAAE,QAAQ,EAAE,EAAE,cAAc,EAAE,CAAC,IAAY,EAAE,EAAE,CAAC,IAAA,SAAE,EAAC,YAAY,CAAC,IAAI,CAAC,CAAC,EAAE,EAAE;KACtG,CAAC;IAEF,OAAO;QACL,IAAA,+BAAmB,EAAC,yBAAyB,CAAC;QAC9C,GAAG,SAAS;KACb,CAAC;AACJ,CAAC","sourcesContent":["import {\n EnvironmentProviders,\n Pipe,\n PipeTransform,\n Provider,\n} from '@angular/core';\nimport {\n TRANSLOCO_LOADER,\n} from '@jsverse/transloco';\nimport {\n LocalizationConfiguration,\n provideLocalization,\n} from '@o3r/transloco';\nimport {\n of,\n} from 'rxjs';\n\n/**\n * Default localization configuration for testing\n */\nconst defaultLocalizationConfiguration = {\n supportedLocales: ['en'],\n language: 'en',\n fallbackLanguage: 'en'\n} as const satisfies Partial<LocalizationConfiguration>;\n\n/**\n * Mock translations interface to provide to the mock localization provider\n */\nexport interface MockTranslations {\n /** Language code mapped to its translation key-value pairs */\n [lang: string]: {\n /** Translation key mapped to its translated value */\n [key: string]: any;\n };\n}\n\n/**\n * Mock pipe for transloco (from \\@jsverse/transloco)\n */\n@Pipe({\n name: 'transloco',\n standalone: true\n})\nexport class TranslocoPipeMock implements PipeTransform {\n /**\n * Transform method for the mock pipe\n * @param args Arguments passed to the pipe\n */\n public transform(...args: any[]): string | undefined {\n return args && args.map((arg) => JSON.stringify(arg)).join(', ');\n }\n}\n\n/**\n * Mock pipe for o3rTranslate\n */\n@Pipe({\n name: 'o3rTranslate',\n standalone: true\n})\nexport class O3rTranslatePipeMock implements PipeTransform {\n /**\n * Transform method for the mock pipe\n * @param args Arguments passed to the pipe\n */\n public transform(...args: any[]): string | undefined {\n return args && args.map((arg) => JSON.stringify(arg)).join(', ');\n }\n}\n\n/**\n * Provides mock localization configuration for testing\n * @param localizationConfiguration Localization configuration\n * @param translations Translations to use\n * @returns List of providers for the TestBed\n */\nexport function provideLocalizationMock(\n localizationConfiguration: Partial<LocalizationConfiguration> = defaultLocalizationConfiguration,\n translations: MockTranslations = {}\n): (Provider | EnvironmentProviders)[] {\n const providers: Provider[] = [\n { provide: TRANSLOCO_LOADER, useValue: { getTranslation: (lang: string) => of(translations[lang]) } }\n ];\n\n return [\n provideLocalization(localizationConfiguration),\n ...providers\n ];\n}\n"]}
|