@ng-forge/dynamic-forms 0.1.1 → 0.1.3

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.
Files changed (20) hide show
  1. package/README.md +33 -0
  2. package/fesm2022/ng-forge-dynamic-forms-integration.mjs +269 -0
  3. package/fesm2022/ng-forge-dynamic-forms-integration.mjs.map +1 -0
  4. package/fesm2022/{ng-forge-dynamic-forms-ng-forge-dynamic-forms-Dcd04rfS.mjs → ng-forge-dynamic-forms-ng-forge-dynamic-forms-B_676NHl.mjs} +989 -1211
  5. package/fesm2022/ng-forge-dynamic-forms-ng-forge-dynamic-forms-B_676NHl.mjs.map +1 -0
  6. package/fesm2022/{ng-forge-dynamic-forms-page-field.component-DjrahUgb.mjs → ng-forge-dynamic-forms-page-field.component-YHFQcpCS.mjs} +31 -29
  7. package/fesm2022/ng-forge-dynamic-forms-page-field.component-YHFQcpCS.mjs.map +1 -0
  8. package/fesm2022/ng-forge-dynamic-forms-testing-test-button.harness-BenmCFcM.mjs +31 -0
  9. package/fesm2022/ng-forge-dynamic-forms-testing-test-button.harness-BenmCFcM.mjs.map +1 -0
  10. package/fesm2022/ng-forge-dynamic-forms-testing.mjs +968 -0
  11. package/fesm2022/ng-forge-dynamic-forms-testing.mjs.map +1 -0
  12. package/fesm2022/{ng-forge-dynamic-forms-text-field.component-7QVNm95W.mjs → ng-forge-dynamic-forms-text-field.component-CiYq73aF.mjs} +2 -2
  13. package/fesm2022/{ng-forge-dynamic-forms-text-field.component-7QVNm95W.mjs.map → ng-forge-dynamic-forms-text-field.component-CiYq73aF.mjs.map} +1 -1
  14. package/fesm2022/ng-forge-dynamic-forms.mjs +1 -1
  15. package/package.json +17 -3
  16. package/types/ng-forge-dynamic-forms-integration.d.ts +315 -0
  17. package/types/ng-forge-dynamic-forms-testing.d.ts +565 -0
  18. package/types/ng-forge-dynamic-forms.d.ts +353 -549
  19. package/fesm2022/ng-forge-dynamic-forms-ng-forge-dynamic-forms-Dcd04rfS.mjs.map +0 -1
  20. package/fesm2022/ng-forge-dynamic-forms-page-field.component-DjrahUgb.mjs.map +0 -1
@@ -0,0 +1,565 @@
1
+ import { Mock } from 'vitest';
2
+ import { DynamicFormLogger, FieldDef, FormConfig, DynamicForm, ValidationMessages, FieldSignalContext } from '@ng-forge/dynamic-forms';
3
+ import { ComponentFixture } from '@angular/core/testing';
4
+ import { ValidationError, form, FieldTree } from '@angular/forms/signals';
5
+ import * as _angular_core from '@angular/core';
6
+ import { Injector, WritableSignal, Type } from '@angular/core';
7
+ import { Observable } from 'rxjs';
8
+
9
+ /**
10
+ * Creates a promise that resolves after the specified delay.
11
+ *
12
+ * Utility function for testing scenarios where you need to wait for
13
+ * asynchronous operations, animations, or timing-dependent behavior.
14
+ *
15
+ * @param ms - Delay in milliseconds (defaults to 0 for next tick)
16
+ * @returns Promise that resolves after the specified delay
17
+ *
18
+ * @example
19
+ * ```typescript
20
+ * // Wait for async operations in tests
21
+ * await delay(100);
22
+ * expect(component.isLoaded).toBe(true);
23
+ *
24
+ * // Wait for next tick (micro-task)
25
+ * await delay();
26
+ * fixture.detectChanges();
27
+ * ```
28
+ */
29
+ declare function delay(ms?: number): Promise<void>;
30
+
31
+ /**
32
+ * Mock logger with vitest spies for testing.
33
+ */
34
+ interface MockLogger extends DynamicFormLogger {
35
+ debug: Mock;
36
+ info: Mock;
37
+ warn: Mock;
38
+ error: Mock;
39
+ }
40
+ /**
41
+ * Creates a mock logger with vitest spies for all methods.
42
+ * Useful for testing code that uses the logger.
43
+ */
44
+ declare function createMockLogger(): MockLogger;
45
+ /**
46
+ * Creates a silent logger that doesn't output anything.
47
+ * Useful for tests where logging output is not relevant.
48
+ */
49
+ declare function createSilentLogger(): DynamicFormLogger;
50
+
51
+ /**
52
+ * Configuration for creating a dynamic form test
53
+ */
54
+ interface DynamicFormTestConfig {
55
+ config: FormConfig;
56
+ initialValue?: Record<string, unknown>;
57
+ registerTestFields?: boolean;
58
+ }
59
+ /**
60
+ * Result of creating a dynamic form test
61
+ */
62
+ interface DynamicFormTestResult {
63
+ component: DynamicForm;
64
+ fixture: ComponentFixture<DynamicForm>;
65
+ }
66
+ /**
67
+ * Fluent API for building form configurations
68
+ */
69
+ declare class FormConfigBuilder {
70
+ private fields;
71
+ field(field: FieldDef<any>): FormConfigBuilder;
72
+ inputField(key: string, props?: Record<string, unknown>): FormConfigBuilder;
73
+ requiredInputField(key: string, props?: Record<string, unknown>): FormConfigBuilder;
74
+ selectField(key: string, options: Array<{
75
+ value: string;
76
+ label: string;
77
+ }>, props?: Record<string, unknown>): FormConfigBuilder;
78
+ checkboxField(key: string, props?: Record<string, unknown>): FormConfigBuilder;
79
+ rowField(key: string, fields: FieldDef<any>[]): FormConfigBuilder;
80
+ groupField(key: string, fields: FieldDef<any>[]): FormConfigBuilder;
81
+ buttonField(key: string, props?: Record<string, unknown>): FormConfigBuilder;
82
+ pageField(key: string, fields: FieldDef<any>[], title?: string): FormConfigBuilder;
83
+ build(): FormConfig;
84
+ }
85
+ /**
86
+ * Utility class for testing dynamic forms
87
+ */
88
+ declare class DynamicFormTestUtils {
89
+ /**
90
+ * Creates a new form config builder
91
+ */
92
+ static builder(): FormConfigBuilder;
93
+ /**
94
+ * Creates a dynamic form test setup with optional test field registration
95
+ */
96
+ static createTest(testConfig: DynamicFormTestConfig): Promise<DynamicFormTestResult>;
97
+ /**
98
+ * Registers common test field types including built-in types like page, row, group
99
+ * @internal
100
+ */
101
+ private static registerTestFields;
102
+ /**
103
+ * Waits for the dynamic form to initialize.
104
+ * Uses the initialized$ observable directly which has shareReplay for late subscribers.
105
+ * @param fixture - The component fixture
106
+ * @param timeoutMs - Maximum time to wait for initialization (default: 100ms)
107
+ */
108
+ static waitForInit(fixture: ComponentFixture<DynamicForm>, timeoutMs?: number): Promise<void>;
109
+ /**
110
+ * Waits for an element to appear in the DOM with retries
111
+ */
112
+ private static waitForElement;
113
+ /**
114
+ * Simulates user input on a field element
115
+ */
116
+ static simulateInput(fixture: ComponentFixture<DynamicForm>, selector: string, value: string): Promise<void>;
117
+ /**
118
+ * Simulates user blur on a field element
119
+ */
120
+ static simulateBlur(fixture: ComponentFixture<DynamicForm>, selector: string): Promise<void>;
121
+ /**
122
+ * Simulates user selection on a select element
123
+ */
124
+ static simulateSelect(fixture: ComponentFixture<DynamicForm>, selector: string, value: string): Promise<void>;
125
+ /**
126
+ * Simulates checkbox toggle
127
+ */
128
+ static simulateCheckbox(fixture: ComponentFixture<DynamicForm>, selector: string, checked: boolean): Promise<void>;
129
+ /**
130
+ * Simulates button click
131
+ */
132
+ static simulateButtonClick(fixture: ComponentFixture<DynamicForm>, selector: string): Promise<void>;
133
+ /**
134
+ * Gets the current form value from the component
135
+ */
136
+ static getFormValue(component: DynamicForm): Record<string, unknown> | undefined;
137
+ /**
138
+ * Gets validation errors from the component
139
+ */
140
+ static getFormErrors(component: DynamicForm): ValidationError[];
141
+ /**
142
+ * Checks if the form is valid
143
+ */
144
+ static isFormValid(component: DynamicForm): boolean;
145
+ /**
146
+ * Gets all field elements from the fixture
147
+ */
148
+ static getFieldElements(fixture: ComponentFixture<DynamicForm>, fieldType: string): NodeListOf<Element>;
149
+ /**
150
+ * Asserts that a field has a specific value
151
+ */
152
+ static assertFieldValue(fixture: ComponentFixture<DynamicForm>, fieldSelector: string, expectedValue: string): Promise<void>;
153
+ /**
154
+ * Asserts that the form has a specific value
155
+ */
156
+ static assertFormValue(component: DynamicForm, expectedValue: Record<string, unknown>): void;
157
+ }
158
+
159
+ /**
160
+ * Configuration for creating a test form injector with field signal context
161
+ */
162
+ interface TestFieldContextConfig<TModel extends Record<string, unknown> = Record<string, unknown>> {
163
+ /**
164
+ * Parent injector to use. If not provided, uses an empty injector.
165
+ */
166
+ parentInjector?: Injector;
167
+ /**
168
+ * Initial value for the form. If not provided, uses an empty object.
169
+ */
170
+ initialValue?: Partial<TModel>;
171
+ /**
172
+ * Default values function. If not provided, returns the initial value.
173
+ */
174
+ defaultValues?: () => TModel;
175
+ /**
176
+ * Default validation messages for the form.
177
+ */
178
+ defaultValidationMessages?: ValidationMessages;
179
+ /**
180
+ * Custom value signal. If provided, this will be used instead of creating a new one.
181
+ */
182
+ valueSignal?: WritableSignal<Partial<TModel> | undefined>;
183
+ /**
184
+ * Custom form instance. If provided, this will be used instead of creating a new one.
185
+ */
186
+ form?: ReturnType<typeof form<TModel>>;
187
+ }
188
+ /**
189
+ * Creates a test injector with FIELD_SIGNAL_CONTEXT provided.
190
+ *
191
+ * This utility simplifies testing of mappers and components that inject FIELD_SIGNAL_CONTEXT.
192
+ *
193
+ * @example
194
+ * ```typescript
195
+ * // Basic usage
196
+ * const testInjector = createTestFormInjector();
197
+ *
198
+ * // With custom initial value
199
+ * const testInjector = createTestFormInjector({
200
+ * initialValue: { username: 'test' }
201
+ * });
202
+ *
203
+ * // With validation messages
204
+ * const testInjector = createTestFormInjector({
205
+ * defaultValidationMessages: { required: 'This field is required' }
206
+ * });
207
+ * ```
208
+ */
209
+ declare function createTestFormInjector<TModel extends Record<string, unknown> = Record<string, unknown>>(config?: TestFieldContextConfig<TModel>): Injector;
210
+ /**
211
+ * Runs a mapper function in a test injection context.
212
+ *
213
+ * This is a convenience wrapper that creates a test injector and runs the mapper
214
+ * function within it, returning the result.
215
+ *
216
+ * @example
217
+ * ```typescript
218
+ * // Test a mapper without context overrides
219
+ * const bindings = testMapper(() => mapValueField(fieldDef));
220
+ *
221
+ * // Test a mapper with custom context
222
+ * const bindings = testMapper(
223
+ * () => mapValueField(fieldDef),
224
+ * { initialValue: { username: 'test' } }
225
+ * );
226
+ *
227
+ * // Test a mapper with validation messages
228
+ * const bindings = testMapper(
229
+ * () => mapValueField(fieldDef),
230
+ * { defaultValidationMessages: { required: 'Required field' } }
231
+ * );
232
+ * ```
233
+ */
234
+ declare function testMapper<T>(mapperFn: () => T, context?: TestFieldContextConfig<Record<string, unknown>>): T;
235
+ /**
236
+ * Creates a field signal context for testing without creating an injector.
237
+ *
238
+ * Useful when you need to manually provide the context or test context creation logic.
239
+ *
240
+ * @example
241
+ * ```typescript
242
+ * const context = createTestFieldContext({
243
+ * initialValue: { name: 'test' }
244
+ * });
245
+ *
246
+ * // Use in your own injector
247
+ * const injector = Injector.create({
248
+ * providers: [
249
+ * { provide: FIELD_SIGNAL_CONTEXT, useValue: context }
250
+ * ]
251
+ * });
252
+ * ```
253
+ */
254
+ declare function createTestFieldContext<TModel extends Record<string, unknown> = Record<string, unknown>>(config?: TestFieldContextConfig<TModel>): FieldSignalContext<TModel>;
255
+
256
+ /**
257
+ * Simple form configuration interface for testing
258
+ */
259
+ interface TestFormConfig$1 {
260
+ fields: FieldDef<any>[];
261
+ }
262
+ /**
263
+ * Configuration for creating a dynamic form test
264
+ */
265
+ interface SimpleTestConfig<T = Record<string, unknown>> {
266
+ config: TestFormConfig$1;
267
+ initialValue?: T;
268
+ }
269
+ /**
270
+ * Result of creating a dynamic form test
271
+ */
272
+ interface SimpleTestResult {
273
+ component: any;
274
+ fixture: any;
275
+ }
276
+ /**
277
+ * Fluent API for building form configurations using existing field structure
278
+ */
279
+ declare class TestFormConfigBuilder<T = Record<string, unknown>> {
280
+ private fields;
281
+ field(field: FieldDef<any>): TestFormConfigBuilder<T>;
282
+ inputField(key: string, props?: Record<string, unknown>): TestFormConfigBuilder<T>;
283
+ requiredInputField(key: string, props?: Record<string, unknown>): TestFormConfigBuilder<T>;
284
+ checkboxField(key: string, props?: Record<string, unknown>): TestFormConfigBuilder<T>;
285
+ build(): TestFormConfig$1;
286
+ }
287
+ /**
288
+ * Simple utility class for testing dynamic forms
289
+ */
290
+ declare class SimpleTestUtils {
291
+ /**
292
+ * Creates a new form config builder
293
+ */
294
+ static builder<T = Record<string, unknown>>(): TestFormConfigBuilder<T>;
295
+ /**
296
+ * Creates a simple test component - assumes TestBed is already configured
297
+ */
298
+ static createComponent<T = Record<string, unknown>>(config?: TestFormConfig$1, initialValue?: T): SimpleTestResult;
299
+ /**
300
+ * Waits for the dynamic form to initialize
301
+ */
302
+ static waitForInit(fixture: any): Promise<void>;
303
+ /**
304
+ * Simulates user input on a field element
305
+ */
306
+ static simulateInput(fixture: any, selector: string, value: string): Promise<void>;
307
+ /**
308
+ * Simulates checkbox toggle
309
+ */
310
+ static simulateCheckbox(fixture: any, selector: string, checked: boolean): Promise<void>;
311
+ /**
312
+ * Gets the current form value from the component
313
+ */
314
+ static getFormValue(component: any): Record<string, unknown> | undefined;
315
+ /**
316
+ * Checks if the form is valid
317
+ */
318
+ static isFormValid(component: any): boolean;
319
+ /**
320
+ * Asserts that the form has a specific value
321
+ */
322
+ static assertFormValue(component: any, expectedValue: Record<string, unknown>): void;
323
+ }
324
+ declare class TestFieldComponent {
325
+ value: _angular_core.WritableSignal<string>;
326
+ key: _angular_core.InputSignal<string>;
327
+ label: _angular_core.InputSignal<string>;
328
+ className: _angular_core.InputSignal<string>;
329
+ tabIndex: _angular_core.InputSignal<number | undefined>;
330
+ props: _angular_core.InputSignal<Record<string, unknown> | undefined>;
331
+ placeholder: _angular_core.InputSignal<string>;
332
+ fields: _angular_core.InputSignal<unknown[]>;
333
+ arrayContext: _angular_core.InputSignal<unknown>;
334
+ validationMessages: _angular_core.InputSignal<Record<string, string> | undefined>;
335
+ defaultValidationMessages: _angular_core.InputSignal<Record<string, string> | undefined>;
336
+ field: _angular_core.InputSignal<unknown>;
337
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<TestFieldComponent, never>;
338
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<TestFieldComponent, "df-test-field", never, { "key": { "alias": "key"; "required": false; "isSignal": true; }; "label": { "alias": "label"; "required": false; "isSignal": true; }; "className": { "alias": "className"; "required": false; "isSignal": true; }; "tabIndex": { "alias": "tabIndex"; "required": false; "isSignal": true; }; "props": { "alias": "props"; "required": false; "isSignal": true; }; "placeholder": { "alias": "placeholder"; "required": false; "isSignal": true; }; "fields": { "alias": "fields"; "required": false; "isSignal": true; }; "arrayContext": { "alias": "arrayContext"; "required": false; "isSignal": true; }; "validationMessages": { "alias": "validationMessages"; "required": false; "isSignal": true; }; "defaultValidationMessages": { "alias": "defaultValidationMessages"; "required": false; "isSignal": true; }; "field": { "alias": "field"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
339
+ }
340
+ /**
341
+ * Configuration for setting up a simple component test
342
+ */
343
+ interface SimpleComponentTestConfig<T = any> {
344
+ field: FieldDef<any>;
345
+ value?: T;
346
+ pageIndex?: number;
347
+ isVisible?: boolean;
348
+ [key: string]: any;
349
+ }
350
+ /**
351
+ * Result of setting up a simple component test
352
+ */
353
+ interface SimpleComponentTestResult<T = any> {
354
+ component: T;
355
+ fixture: ComponentFixture<T>;
356
+ }
357
+ /**
358
+ * Creates a simple test setup for individual field components
359
+ */
360
+ declare function setupSimpleTest<T>(componentType: Type<T>, config: SimpleComponentTestConfig): SimpleComponentTestResult<T>;
361
+ /**
362
+ * Creates a simple test field definition
363
+ */
364
+ declare function createSimpleTestField(key: string, label: string): FieldDef<any>;
365
+
366
+ /**
367
+ * Simple form configuration interface for testing
368
+ */
369
+ interface TestFormConfig {
370
+ fields: FieldDef<any>[];
371
+ }
372
+ /**
373
+ * Unified configuration for creating dynamic form tests
374
+ * Replaces DynamicFormTestConfig and SimpleTestConfig
375
+ */
376
+ interface TestConfig<T = Record<string, unknown>> {
377
+ config: FormConfig | TestFormConfig;
378
+ initialValue?: T;
379
+ registerTestFields?: boolean;
380
+ }
381
+ /**
382
+ * Unified result interface for dynamic form tests
383
+ * Replaces DynamicFormTestResult and SimpleTestResult
384
+ */
385
+ interface TestResult<T = unknown> {
386
+ component: T;
387
+ fixture: ComponentFixture<T>;
388
+ }
389
+ /**
390
+ * Configuration for setting up individual field component tests
391
+ */
392
+ interface ComponentTestConfig<T = unknown> {
393
+ field: FieldDef<any>;
394
+ value?: T;
395
+ }
396
+ /**
397
+ * Result of setting up individual field component tests
398
+ */
399
+ interface ComponentTestResult<T = unknown> {
400
+ component: T;
401
+ fixture: ComponentFixture<T>;
402
+ }
403
+
404
+ declare class TestInputHarness {
405
+ readonly field: _angular_core.InputSignal<FieldTree<string>>;
406
+ readonly key: _angular_core.InputSignal<string>;
407
+ readonly label: _angular_core.InputSignal<string>;
408
+ readonly placeholder: _angular_core.InputSignal<string>;
409
+ readonly type: _angular_core.InputSignal<string>;
410
+ readonly props: _angular_core.InputSignal<Record<string, unknown>>;
411
+ readonly className: _angular_core.InputSignal<string>;
412
+ readonly validationMessages: _angular_core.InputSignal<ValidationMessages | undefined>;
413
+ readonly defaultValidationMessages: _angular_core.InputSignal<ValidationMessages | undefined>;
414
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<TestInputHarness, never>;
415
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<TestInputHarness, "df-test-input", never, { "field": { "alias": "field"; "required": true; "isSignal": true; }; "key": { "alias": "key"; "required": true; "isSignal": true; }; "label": { "alias": "label"; "required": false; "isSignal": true; }; "placeholder": { "alias": "placeholder"; "required": false; "isSignal": true; }; "type": { "alias": "type"; "required": false; "isSignal": true; }; "props": { "alias": "props"; "required": false; "isSignal": true; }; "className": { "alias": "className"; "required": false; "isSignal": true; }; "validationMessages": { "alias": "validationMessages"; "required": false; "isSignal": true; }; "defaultValidationMessages": { "alias": "defaultValidationMessages"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
416
+ }
417
+
418
+ declare class TestCheckboxHarness {
419
+ readonly field: _angular_core.InputSignal<FieldTree<boolean>>;
420
+ readonly key: _angular_core.InputSignal<string>;
421
+ readonly label: _angular_core.InputSignal<string>;
422
+ readonly props: _angular_core.InputSignal<Record<string, unknown>>;
423
+ readonly className: _angular_core.InputSignal<string>;
424
+ readonly validationMessages: _angular_core.InputSignal<ValidationMessages | undefined>;
425
+ readonly defaultValidationMessages: _angular_core.InputSignal<ValidationMessages | undefined>;
426
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<TestCheckboxHarness, never>;
427
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<TestCheckboxHarness, "df-test-checkbox", never, { "field": { "alias": "field"; "required": true; "isSignal": true; }; "key": { "alias": "key"; "required": true; "isSignal": true; }; "label": { "alias": "label"; "required": false; "isSignal": true; }; "props": { "alias": "props"; "required": false; "isSignal": true; }; "className": { "alias": "className"; "required": false; "isSignal": true; }; "validationMessages": { "alias": "validationMessages"; "required": false; "isSignal": true; }; "defaultValidationMessages": { "alias": "defaultValidationMessages"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
428
+ }
429
+
430
+ /**
431
+ * Test harness component for select fields
432
+ */
433
+ declare class TestSelectHarness {
434
+ readonly field: _angular_core.InputSignal<FieldTree<string>>;
435
+ readonly key: _angular_core.InputSignal<string>;
436
+ readonly label: _angular_core.InputSignal<string>;
437
+ readonly options: _angular_core.InputSignal<{
438
+ value: string;
439
+ label: string;
440
+ }[]>;
441
+ readonly className: _angular_core.InputSignal<string>;
442
+ readonly tabIndex: _angular_core.InputSignal<number | undefined>;
443
+ readonly hidden: _angular_core.InputSignal<boolean>;
444
+ readonly readonly: _angular_core.InputSignal<boolean>;
445
+ readonly props: _angular_core.InputSignal<Record<string, unknown>>;
446
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<TestSelectHarness, never>;
447
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<TestSelectHarness, "df-test-select", never, { "field": { "alias": "field"; "required": true; "isSignal": true; }; "key": { "alias": "key"; "required": true; "isSignal": true; }; "label": { "alias": "label"; "required": false; "isSignal": true; }; "options": { "alias": "options"; "required": false; "isSignal": true; }; "className": { "alias": "className"; "required": false; "isSignal": true; }; "tabIndex": { "alias": "tabIndex"; "required": false; "isSignal": true; }; "hidden": { "alias": "hidden"; "required": false; "isSignal": true; }; "readonly": { "alias": "readonly"; "required": false; "isSignal": true; }; "props": { "alias": "props"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
448
+ }
449
+
450
+ /**
451
+ * Fake translation service for testing dynamic text functionality.
452
+ * Provides Observable-based translation methods with language switching simulation.
453
+ *
454
+ * @example
455
+ * ```typescript
456
+ * TestBed.configureTestingModule({
457
+ * providers: [
458
+ * { provide: TranslationService, useClass: FakeTranslationService }
459
+ * ]
460
+ * });
461
+ *
462
+ * const service = TestBed.inject(FakeTranslationService);
463
+ * service.setTranslations({
464
+ * 'form.username.label': 'Username',
465
+ * 'validation.required': 'This field is required'
466
+ * });
467
+ * ```
468
+ *
469
+ * @public
470
+ */
471
+ declare class FakeTranslationService {
472
+ private readonly translations;
473
+ private readonly currentLanguage;
474
+ /**
475
+ * Set the translation dictionary
476
+ */
477
+ setTranslations(translations: Record<string, string>): void;
478
+ /**
479
+ * Add translations to the existing dictionary
480
+ */
481
+ addTranslations(translations: Record<string, string>): void;
482
+ /**
483
+ * Simulate language change
484
+ */
485
+ setLanguage(language: string): void;
486
+ /**
487
+ * Get current language as signal
488
+ */
489
+ getLanguage(): _angular_core.WritableSignal<string>;
490
+ /**
491
+ * Translate a key and return an Observable
492
+ * Supports parameter interpolation using {{param}} syntax
493
+ */
494
+ translate(key: string, params?: Record<string, unknown>): Observable<string>;
495
+ /**
496
+ * Get instant translation (synchronous)
497
+ * Supports parameter interpolation using {{param}} syntax
498
+ */
499
+ instant(key: string, params?: Record<string, unknown>): string;
500
+ /**
501
+ * Simulate translation for validation errors
502
+ * Uses validation.${errorKind} pattern
503
+ */
504
+ translateValidationError(errorKind: string, params?: Record<string, unknown>): Observable<string>;
505
+ /**
506
+ * Get all current translations
507
+ */
508
+ getTranslations(): Record<string, string>;
509
+ /**
510
+ * Clear all translations
511
+ */
512
+ clearTranslations(): void;
513
+ private interpolateParams;
514
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<FakeTranslationService, never>;
515
+ static ɵprov: _angular_core.ɵɵInjectableDeclaration<FakeTranslationService>;
516
+ }
517
+ /**
518
+ * Default translations for common form fields and validation messages
519
+ * Useful for quick testing setup
520
+ */
521
+ declare const DEFAULT_TEST_TRANSLATIONS: {
522
+ 'form.username.label': string;
523
+ 'form.email.label': string;
524
+ 'form.password.label': string;
525
+ 'form.firstName.label': string;
526
+ 'form.lastName.label': string;
527
+ 'form.phone.label': string;
528
+ 'form.address.label': string;
529
+ 'form.username.placeholder': string;
530
+ 'form.email.placeholder': string;
531
+ 'form.password.placeholder': string;
532
+ 'validation.required': string;
533
+ 'validation.email': string;
534
+ 'validation.min': string;
535
+ 'validation.max': string;
536
+ 'validation.minLength': string;
537
+ 'validation.maxLength': string;
538
+ 'validation.pattern': string;
539
+ 'buttons.submit': string;
540
+ 'buttons.cancel': string;
541
+ 'buttons.save': string;
542
+ 'buttons.delete': string;
543
+ 'buttons.edit': string;
544
+ greeting: string;
545
+ goodbye: string;
546
+ };
547
+ /**
548
+ * Alternative translations for testing language switching
549
+ */
550
+ declare const SPANISH_TEST_TRANSLATIONS: {
551
+ 'form.username.label': string;
552
+ 'form.email.label': string;
553
+ 'form.password.label': string;
554
+ 'validation.required': string;
555
+ 'validation.email': string;
556
+ greeting: string;
557
+ goodbye: string;
558
+ };
559
+ /**
560
+ * Test utility to create a configured FakeTranslationService with default translations
561
+ */
562
+ declare function createTestTranslationService(initialTranslations?: Record<string, string>): FakeTranslationService;
563
+
564
+ export { DEFAULT_TEST_TRANSLATIONS, DynamicFormTestUtils, FakeTranslationService, FormConfigBuilder, SPANISH_TEST_TRANSLATIONS, TestFormConfigBuilder as SimpleFormConfigBuilder, SimpleTestUtils, TestCheckboxHarness as TestCheckboxHarnessComponent, TestFieldComponent, TestInputHarness as TestInputHarnessComponent, TestSelectHarness as TestSelectHarnessComponent, createMockLogger, createSilentLogger, createSimpleTestField, createTestFieldContext, createTestFormInjector, createTestTranslationService, delay, setupSimpleTest, testMapper };
565
+ export type { ComponentTestConfig, ComponentTestResult, DynamicFormTestConfig, DynamicFormTestResult, MockLogger, SimpleComponentTestConfig, SimpleComponentTestResult, SimpleTestConfig, SimpleTestResult, TestConfig, TestFieldContextConfig, TestFormConfig, TestResult };