@ruc-lib/metaform 2.0.1 → 2.0.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 (71) hide show
  1. package/package.json +39 -20
  2. package/.eslintrc.json +0 -36
  3. package/dist/README.md +0 -135
  4. package/dist/package.json +0 -38
  5. package/jest.config.ts +0 -22
  6. package/ng-package.json +0 -6
  7. package/project.json +0 -50
  8. package/src/components/ruc-meta-checkbox-group/ruc-meta-checkbox-group.component.css +0 -10
  9. package/src/components/ruc-meta-checkbox-group/ruc-meta-checkbox-group.component.html +0 -11
  10. package/src/components/ruc-meta-checkbox-group/ruc-meta-checkbox-group.component.spec.ts +0 -103
  11. package/src/components/ruc-meta-checkbox-group/ruc-meta-checkbox-group.component.ts +0 -33
  12. package/src/components/ruc-meta-inputs/ruc-meta-inputs.component.css +0 -16
  13. package/src/components/ruc-meta-inputs/ruc-meta-inputs.component.html +0 -18
  14. package/src/components/ruc-meta-inputs/ruc-meta-inputs.component.spec.ts +0 -85
  15. package/src/components/ruc-meta-inputs/ruc-meta-inputs.component.ts +0 -44
  16. package/src/components/ruc-meta-radio-group/ruc-meta-radio-group.component.css +0 -13
  17. package/src/components/ruc-meta-radio-group/ruc-meta-radio-group.component.html +0 -12
  18. package/src/components/ruc-meta-radio-group/ruc-meta-radio-group.component.spec.ts +0 -98
  19. package/src/components/ruc-meta-radio-group/ruc-meta-radio-group.component.ts +0 -28
  20. package/src/components/ruc-meta-select/ruc-meta-select.component.css +0 -9
  21. package/src/components/ruc-meta-select/ruc-meta-select.component.html +0 -12
  22. package/src/components/ruc-meta-select/ruc-meta-select.component.spec.ts +0 -1165
  23. package/src/components/ruc-meta-select/ruc-meta-select.component.ts +0 -45
  24. package/src/components/ruc-text-area/ruc-text-area.component.css +0 -0
  25. package/src/components/ruc-text-area/ruc-text-area.component.html +0 -16
  26. package/src/components/ruc-text-area/ruc-text-area.component.spec.ts +0 -100
  27. package/src/components/ruc-text-area/ruc-text-area.component.ts +0 -30
  28. package/src/index.ts +0 -2
  29. package/src/interfaces/metaFormsDefault.ts +0 -71
  30. package/src/lib/ruclib-metaform/ruclib-metaform.component.html +0 -99
  31. package/src/lib/ruclib-metaform/ruclib-metaform.component.scss +0 -15
  32. package/src/lib/ruclib-metaform/ruclib-metaform.component.spec.ts +0 -1253
  33. package/src/lib/ruclib-metaform/ruclib-metaform.component.stories.ts +0 -676
  34. package/src/lib/ruclib-metaform/ruclib-metaform.component.ts +0 -91
  35. package/src/lib/ruclib-metaform.module.ts +0 -59
  36. package/src/services/ruc-meta-form-validation.service.spec.ts +0 -75
  37. package/src/services/ruc-meta-form-validation.service.ts +0 -30
  38. package/src/services/ruc-meta-form.service.spec.ts +0 -63
  39. package/src/services/ruc-meta-form.service.ts +0 -20
  40. package/src/test-setup.ts +0 -1
  41. package/tsconfig.json +0 -30
  42. package/tsconfig.lib.json +0 -17
  43. package/tsconfig.lib.prod.json +0 -9
  44. package/tsconfig.spec.json +0 -16
  45. /package/{dist/components → components}/ruc-meta-checkbox-group/ruc-meta-checkbox-group.component.d.ts +0 -0
  46. /package/{dist/components → components}/ruc-meta-inputs/ruc-meta-inputs.component.d.ts +0 -0
  47. /package/{dist/components → components}/ruc-meta-radio-group/ruc-meta-radio-group.component.d.ts +0 -0
  48. /package/{dist/components → components}/ruc-meta-select/ruc-meta-select.component.d.ts +0 -0
  49. /package/{dist/components → components}/ruc-text-area/ruc-text-area.component.d.ts +0 -0
  50. /package/{dist/esm2020 → esm2020}/components/ruc-meta-checkbox-group/ruc-meta-checkbox-group.component.mjs +0 -0
  51. /package/{dist/esm2020 → esm2020}/components/ruc-meta-inputs/ruc-meta-inputs.component.mjs +0 -0
  52. /package/{dist/esm2020 → esm2020}/components/ruc-meta-radio-group/ruc-meta-radio-group.component.mjs +0 -0
  53. /package/{dist/esm2020 → esm2020}/components/ruc-meta-select/ruc-meta-select.component.mjs +0 -0
  54. /package/{dist/esm2020 → esm2020}/components/ruc-text-area/ruc-text-area.component.mjs +0 -0
  55. /package/{dist/esm2020 → esm2020}/index.mjs +0 -0
  56. /package/{dist/esm2020 → esm2020}/interfaces/metaFormsDefault.mjs +0 -0
  57. /package/{dist/esm2020 → esm2020}/lib/ruclib-metaform/ruclib-metaform.component.mjs +0 -0
  58. /package/{dist/esm2020 → esm2020}/lib/ruclib-metaform.module.mjs +0 -0
  59. /package/{dist/esm2020 → esm2020}/ruc-lib-metaform.mjs +0 -0
  60. /package/{dist/esm2020 → esm2020}/services/ruc-meta-form-validation.service.mjs +0 -0
  61. /package/{dist/esm2020 → esm2020}/services/ruc-meta-form.service.mjs +0 -0
  62. /package/{dist/fesm2015 → fesm2015}/ruc-lib-metaform.mjs +0 -0
  63. /package/{dist/fesm2015 → fesm2015}/ruc-lib-metaform.mjs.map +0 -0
  64. /package/{dist/fesm2020 → fesm2020}/ruc-lib-metaform.mjs +0 -0
  65. /package/{dist/fesm2020 → fesm2020}/ruc-lib-metaform.mjs.map +0 -0
  66. /package/{dist/index.d.ts → index.d.ts} +0 -0
  67. /package/{dist/interfaces → interfaces}/metaFormsDefault.d.ts +0 -0
  68. /package/{dist/lib → lib}/ruclib-metaform/ruclib-metaform.component.d.ts +0 -0
  69. /package/{dist/lib → lib}/ruclib-metaform.module.d.ts +0 -0
  70. /package/{dist/services → services}/ruc-meta-form-validation.service.d.ts +0 -0
  71. /package/{dist/services → services}/ruc-meta-form.service.d.ts +0 -0
@@ -1,1253 +0,0 @@
1
- import { ComponentFixture, TestBed, fakeAsync, tick } from '@angular/core/testing';
2
-
3
- import { RuclibMetaformComponent } from './ruclib-metaform.component';
4
- import { HttpClientTestingModule, HttpTestingController } from '@angular/common/http/testing';
5
- import { RucMetaFormService } from '../../services/ruc-meta-form.service';
6
- import { HttpClientModule } from '@angular/common/http';
7
- import { RucMetaFormValidationService } from '../../services/ruc-meta-form-validation.service';
8
- import { MetaFormConfig } from '../../interfaces/metaFormsDefault';
9
- import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
10
-
11
- import { FormsModule } from '@angular/forms';
12
- import { MatFormFieldModule } from '@angular/material/form-field';
13
- import { MatInputModule } from '@angular/material/input';
14
- import { MatRadioModule } from '@angular/material/radio';
15
- import { MatCheckboxModule } from '@angular/material/checkbox';
16
- import { MatSelectModule } from '@angular/material/select';
17
- import { MatAutocompleteModule } from '@angular/material/autocomplete';
18
- import { MatButtonModule} from '@angular/material/button';
19
- import { MatTooltipModule} from '@angular/material/tooltip';
20
- import { TextFieldModule} from '@angular/cdk/text-field';
21
- import {MatStepperModule} from '@angular/material/stepper';
22
-
23
- import { RucMetaInputsComponent } from '../../components/ruc-meta-inputs/ruc-meta-inputs.component';
24
- import { RucMetaRadioGroupComponent } from '../../components/ruc-meta-radio-group/ruc-meta-radio-group.component';
25
- import { RucMetaCheckboxGroupComponent } from '../../components/ruc-meta-checkbox-group/ruc-meta-checkbox-group.component';
26
- import { RucMetaSelectComponent } from '../../components/ruc-meta-select/ruc-meta-select.component';
27
- import { RucTextAreaComponent } from '../../components/ruc-text-area/ruc-text-area.component';
28
-
29
- import { of } from 'rxjs';
30
- describe('RuclibMetaformComponent', () => {
31
- let component: RuclibMetaformComponent;
32
- let fixture: ComponentFixture<RuclibMetaformComponent>;
33
- let mockFormData: MetaFormConfig[] = [];
34
- let service: RucMetaFormService;
35
-
36
- mockFormData = [
37
- {
38
- "formType": "simple",
39
- "fieldType": "input",
40
- "inputType": "text",
41
- "id": "firstName",
42
- "name": "firstName",
43
- "errorMsg": false,
44
- "label": "First Name",
45
- "className": "firstName",
46
- "value": "",
47
- "alt": "na",
48
- "appearance": "outline",
49
- "min": "4",
50
- "max": "20",
51
- "width": "100",
52
- "height": "20",
53
- "checked": false,
54
- "disabled": false,
55
- "maxlength": "100",
56
- "readonly": false,
57
- "required": false,
58
- "size": "100",
59
- "tooltip": "First Name",
60
- "tooltipPosition": "right",
61
- "pattern": "any",
62
- "placeholder": "First Name",
63
- "autofocus": true,
64
- "autocomplete": ["amar", "bharat", "charan"],
65
- "customComponentName": "none",
66
- "rucDialogInput": {},
67
- "hasDependentFields": false,
68
- "dependentFieldParentId": "any",
69
- "dependentFields": [],
70
- "toolTipDescription": "none",
71
- "showErrorOnPopUp": true,
72
- "groupOptions": []
73
- },
74
- {
75
- "formType": "simple",
76
- "fieldType": "input",
77
- "inputType": "text",
78
- "id": "lastName",
79
- "errorMsg": false,
80
- "name": "lastName",
81
- "label": "Last Name",
82
- "className": "lastName",
83
- "value": "",
84
- "alt": "na",
85
- "appearance": "outline",
86
- "min": "4",
87
- "max": "20",
88
- "width": "100",
89
- "height": "20",
90
- "checked": false,
91
- "disabled": false,
92
- "maxlength": "100",
93
- "readonly": false,
94
- "required": true,
95
- "size": "100",
96
- "sameRow": true,
97
- "sameRowColumnWidth": "50",
98
- "tooltip": "Last Name",
99
- "tooltipPosition": "below",
100
- "pattern": "any",
101
- "placeholder": "Last Name",
102
- "autofocus": true,
103
- "autocomplete": ["singh", "rai", "lal"],
104
- "customComponentName": "none",
105
- "rucDialogInput": {},
106
- "hasDependentFields": false,
107
- "dependentFieldParentId": "any",
108
- "dependentFields": [],
109
- "toolTipDescription": "none",
110
- "showErrorOnPopUp": true,
111
- "groupOptions": []
112
- },
113
-
114
- {
115
-
116
- "formType": "simple",
117
-
118
- "fieldType": "input",
119
-
120
- "inputType": "password",
121
-
122
- "id": "password",
123
-
124
- "errorMsg": false,
125
-
126
- "name": "password",
127
-
128
- "label": "Password",
129
-
130
- "className": "password",
131
-
132
- "value": "",
133
-
134
- "alt": "na",
135
-
136
- "appearance": "outline",
137
-
138
- "min": "4",
139
-
140
- "max": "20",
141
-
142
- "width": "100",
143
-
144
- "height": "20",
145
-
146
- "checked": false,
147
-
148
- "disabled": false,
149
-
150
- "maxlength": "100",
151
-
152
- "readonly": false,
153
-
154
- "required": true,
155
-
156
- "size": "100",
157
-
158
- "sameRow": true,
159
-
160
- "sameRowColumnWidth": "25",
161
-
162
- "tooltip": "Password",
163
-
164
- "tooltipPosition": "right",
165
-
166
- "pattern": "any",
167
-
168
- "placeholder": "First Name",
169
-
170
- "autofocus": true,
171
-
172
- "autocomplete": false,
173
-
174
- "customComponentName": "none",
175
-
176
- "rucDialogInput": {},
177
-
178
- "hasDependentFields": false,
179
-
180
- "dependentFieldParentId": "any",
181
-
182
- "dependentFields": [],
183
-
184
- "toolTipDescription": "none",
185
-
186
- "showErrorOnPopUp": true,
187
-
188
- "groupOptions": []
189
-
190
- },
191
-
192
- {
193
-
194
- "formType": "simple",
195
-
196
- "fieldType": "radio",
197
-
198
- "inputType": "radio",
199
-
200
- "id": "radio",
201
-
202
- "name": "radio",
203
-
204
- "errorMsg": false,
205
-
206
- "label": "Pick your favorite season",
207
-
208
- "className": "radio",
209
-
210
- "value": "",
211
-
212
- "alt": "na",
213
-
214
- "appearance": "outline",
215
-
216
- "min": "4",
217
-
218
- "max": "20",
219
-
220
- "width": "100",
221
-
222
- "height": "20",
223
-
224
- "checked": false,
225
-
226
- "disabled": false,
227
-
228
- "maxlength": "100",
229
-
230
- "readonly": false,
231
-
232
- "required": true,
233
-
234
- "size": "100",
235
-
236
- "sameRow": false,
237
-
238
- "sameRowColumnWidth": "100",
239
-
240
- "tooltip": "Radio",
241
-
242
- "tooltipPosition": "left",
243
-
244
- "pattern": "any",
245
-
246
- "placeholder": "",
247
-
248
- "autofocus": true,
249
-
250
- "autocomplete": false,
251
-
252
- "customComponentName": "none",
253
-
254
- "rucDialogInput": {},
255
-
256
- "hasDependentFields": false,
257
-
258
- "dependentFieldParentId": "any",
259
-
260
- "dependentFields": [],
261
-
262
- "toolTipDescription": "none",
263
-
264
- "showErrorOnPopUp": true,
265
-
266
- "groupOptions": [
267
-
268
- {
269
-
270
- "id": "Winter",
271
-
272
- "name": "Winter",
273
-
274
- "value": ""
275
-
276
- },
277
-
278
- {
279
-
280
- "id": "Spring",
281
-
282
- "name": "Spring",
283
-
284
- "value": ""
285
-
286
- },
287
-
288
- {
289
-
290
- "id": "Summer",
291
-
292
- "name": "Summer",
293
-
294
- "value": ""
295
-
296
- },
297
-
298
- {
299
-
300
- "id": "Autumn",
301
-
302
- "name": "Autumn",
303
-
304
- "value": ""
305
-
306
- }
307
-
308
- ]
309
-
310
- },
311
-
312
- {
313
-
314
- "formType": "simple",
315
-
316
- "fieldType": "checkbox",
317
-
318
- "inputType": "checkbox",
319
-
320
- "id": "radio",
321
-
322
- "name": "radio",
323
-
324
- "label": "Checkbox configuration",
325
-
326
- "className": "checkbox",
327
-
328
- "value": "",
329
-
330
- "alt": "na",
331
-
332
- "appearance": "outline",
333
-
334
- "min": "4",
335
-
336
- "max": "20",
337
-
338
- "width": "100",
339
-
340
- "height": "20",
341
-
342
- "checked": false,
343
-
344
- "disabled": false,
345
-
346
- "maxlength": "100",
347
-
348
- "readonly": false,
349
-
350
- "required": true,
351
-
352
- "size": "100",
353
-
354
- "sameRow": false,
355
-
356
- "sameRowColumnWidth": "100",
357
-
358
- "tooltip": "Checkpoint",
359
-
360
- "tooltipPosition": "above",
361
-
362
- "pattern": "any",
363
-
364
- "placeholder": "",
365
-
366
- "autofocus": true,
367
-
368
- "autocomplete": false,
369
-
370
- "customComponentName": "none",
371
-
372
- "rucDialogInput": {},
373
-
374
- "hasDependentFields": false,
375
-
376
- "dependentFieldParentId": "any",
377
-
378
- "dependentFields": [],
379
-
380
- "toolTipDescription": "none",
381
-
382
- "errorMsg": false,
383
-
384
- "customErrorMessage": "invalid selection",
385
-
386
- "showErrorOnPopUp": true,
387
-
388
- "groupOptions": [
389
-
390
- {
391
-
392
- "id": "Winter",
393
-
394
- "name": "Winter",
395
-
396
- "value": "Winter"
397
-
398
- },
399
-
400
- {
401
-
402
- "id": "Spring",
403
-
404
- "name": "Spring",
405
-
406
- "value": "Spring"
407
-
408
- },
409
-
410
- {
411
-
412
- "id": "Summer",
413
-
414
- "name": "Summer",
415
-
416
- "value": "Summer"
417
-
418
- },
419
-
420
- {
421
-
422
- "id": "Autumn",
423
-
424
- "name": "Autumn",
425
-
426
- "value": "Autumn"
427
-
428
- }
429
-
430
- ]
431
-
432
- },
433
-
434
- {
435
-
436
- "formType": "simple",
437
-
438
- "fieldType": "select",
439
-
440
- "inputType": "select",
441
-
442
- "id": "select",
443
-
444
- "name": "select",
445
-
446
- "label": "select configuration",
447
-
448
- "className": "select",
449
-
450
- "value": "",
451
-
452
- "alt": "na",
453
-
454
- "appearance": "outline",
455
-
456
- "min": "4",
457
-
458
- "max": "20",
459
-
460
- "width": "100",
461
-
462
- "height": "20",
463
-
464
- "checked": false,
465
-
466
- "disabled": false,
467
-
468
- "maxlength": "100",
469
-
470
- "readonly": false,
471
-
472
- "required": true,
473
-
474
- "size": "100",
475
-
476
-
477
- "sameRow": true,
478
-
479
- "tooltip": "select",
480
-
481
- "tooltipPosition": "below",
482
-
483
- "sameRowColumnWidth": "100",
484
-
485
- "pattern": "any",
486
-
487
- "placeholder": "",
488
-
489
- "autofocus": true,
490
-
491
- "autocomplete": false,
492
-
493
- "customComponentName": "none",
494
-
495
- "rucDialogInput": {},
496
-
497
- "hasDependentFields": true,
498
-
499
- "toolTipDescription": "none",
500
-
501
- "errorMsg": false,
502
-
503
- "customErrorMessage": "Invalid select option",
504
-
505
- "showErrorOnPopUp": true,
506
-
507
- "groupOptions": [
508
-
509
- {
510
-
511
- "id": "w11",
512
-
513
- "name": "Winter",
514
-
515
- "value": "Winter"
516
-
517
- },
518
-
519
- {
520
-
521
- "id": "s1",
522
-
523
- "name": "Spring",
524
-
525
- "value": "Spring"
526
-
527
- },
528
-
529
- {
530
-
531
- "id": "su1",
532
-
533
- "name": "Summer",
534
-
535
- "value": "Summer",
536
-
537
- "disable": true
538
-
539
- },
540
-
541
- {
542
-
543
- "id": "a1",
544
-
545
- "name": "Autumn",
546
-
547
- "value": "Autumn"
548
-
549
- }
550
-
551
- ],
552
-
553
- "dependentFields":
554
-
555
- [
556
-
557
- {
558
-
559
- "formType": "simple",
560
-
561
- "fieldType": "input",
562
-
563
- "inputType": "text",
564
-
565
- "id": "w1",
566
-
567
- "name": "w1",
568
-
569
- "errorMsg": false,
570
-
571
- "label": "Winter Name",
572
-
573
- "className": "winter",
574
-
575
- "value": "",
576
-
577
- "alt": "na",
578
-
579
- "appearance": "outline",
580
-
581
- "min": "4",
582
-
583
- "max": "20",
584
-
585
- "width": "50%",
586
-
587
- "height": "20",
588
-
589
- "checked": false,
590
-
591
- "disabled": false,
592
-
593
- "maxlength": "100",
594
-
595
- "readonly": false,
596
-
597
- "required": false,
598
-
599
- "size": "100",
600
-
601
- "pattern": "any",
602
-
603
- "placeholder": "w1 Name",
604
-
605
- "autofocus": false,
606
-
607
- "autocomplete": "",
608
-
609
- "customComponentName": "none",
610
-
611
- "rucDialogInput": {},
612
-
613
- "hasDependentFields": false,
614
-
615
- "dependentFieldParentId": "w11",
616
-
617
- "dependentFields": [],
618
-
619
- "toolTipDescription": "none",
620
-
621
- "showErrorOnPopUp": true,
622
-
623
- "groupOptions": []
624
-
625
- },
626
-
627
- {
628
-
629
- "formType": "simple",
630
-
631
- "fieldType": "input",
632
-
633
- "inputType": "text",
634
-
635
- "id": "a11",
636
-
637
- "name": "a11",
638
-
639
- "errorMsg": false,
640
-
641
- "label": "Autumn Name",
642
-
643
- "className": "Autumn",
644
-
645
- "value": "",
646
-
647
- "alt": "na",
648
-
649
- "appearance": "outline",
650
-
651
- "min": "4",
652
-
653
- "max": "20",
654
-
655
- "width": "50%",
656
-
657
- "height": "20",
658
-
659
- "checked": false,
660
-
661
- "disabled": false,
662
-
663
- "maxlength": "100",
664
-
665
- "readonly": false,
666
-
667
- "required": false,
668
-
669
- "size": "100",
670
-
671
- "pattern": "any",
672
-
673
- "placeholder": "Autumn Name",
674
-
675
- "autofocus": false,
676
-
677
- "autocomplete": "",
678
-
679
- "customComponentName": "none",
680
-
681
- "rucDialogInput": {},
682
-
683
- "hasDependentFields": false,
684
-
685
- "dependentFieldParentId": "a1",
686
-
687
- "dependentFields": [],
688
-
689
- "toolTipDescription": "none",
690
-
691
- "showErrorOnPopUp": true,
692
-
693
- "groupOptions": []
694
-
695
- }]
696
-
697
-
698
-
699
- },
700
-
701
- {
702
-
703
- "formType": "simple",
704
-
705
- "fieldType": "select",
706
-
707
- "inputType": "select",
708
-
709
- "id": "country",
710
-
711
- "name": "select",
712
-
713
- "label": "select Country",
714
-
715
- "className": "select",
716
-
717
- "value": "India",
718
-
719
- "alt": "na",
720
-
721
- "min": "4",
722
-
723
- "max": "20",
724
-
725
- "width": "50%",
726
-
727
- "size": "100",
728
-
729
- "height": "20",
730
-
731
- "appearance": "outline",
732
-
733
- "autofocus": true,
734
-
735
- "autocomplete": false,
736
-
737
- "sameRow": false,
738
-
739
- "sameRowColumnWidth": "100",
740
-
741
- "tooltip": "select",
742
-
743
- "tooltipPosition": "above",
744
-
745
- "rucDialogInput": {},
746
-
747
- "hasDependentFields": true,
748
-
749
- "errorMsg": false,
750
-
751
- "customErrorMessage": "Invalid select option",
752
-
753
- "showErrorOnPopUp": true,
754
-
755
- "selectedParentId": "ind1",
756
-
757
- "groupOptions": [
758
-
759
- {
760
-
761
- "id": "ind1",
762
-
763
- "name": "India",
764
-
765
- "value": "India"
766
-
767
- },
768
-
769
- {
770
-
771
- "id": "usa1",
772
-
773
- "name": "USA",
774
-
775
- "value": "USA"
776
-
777
- },
778
-
779
- {
780
-
781
- "id": "uk1",
782
-
783
- "name": "UK",
784
-
785
- "value": "UK"
786
-
787
- },
788
-
789
- {
790
-
791
- "id": "ch1",
792
-
793
- "name": "Chaina",
794
-
795
- "value": "Chaina"
796
-
797
- }
798
-
799
- ],
800
-
801
- "dependentFields": [
802
-
803
- {
804
-
805
- "formType": "simple",
806
-
807
- "fieldType": "select",
808
-
809
- "inputType": "select",
810
-
811
- "id": "indianState",
812
-
813
- "name": "select",
814
-
815
- "label": "select State",
816
-
817
- "className": "select",
818
-
819
- "value": "MP",
820
-
821
- "appearance": "outline",
822
-
823
- "hasDependentFields": true,
824
-
825
- "dependentFieldParentId": "ind1",
826
-
827
- "selectedParentId": "mp1",
828
-
829
- "groupOptions": [
830
-
831
- {
832
-
833
- "id": "mp1",
834
-
835
- "name": "MP",
836
-
837
- "value": "MP"
838
-
839
- },
840
-
841
- {
842
-
843
- "id": "up1",
844
-
845
- "name": "UP",
846
-
847
- "value": "UP"
848
-
849
- },
850
-
851
- {
852
-
853
- "id": "pb1",
854
-
855
- "name": "PB",
856
-
857
- "value": "PB"
858
-
859
- }
860
-
861
- ],
862
-
863
- "dependentFields": [
864
-
865
- {
866
-
867
- "formType": "simple",
868
-
869
- "fieldType": "select",
870
-
871
- "inputType": "select",
872
-
873
- "id": "mpCity",
874
-
875
- "name": "select",
876
-
877
- "label": "select City",
878
-
879
- "className": "select",
880
-
881
- "appearance": "outline",
882
-
883
- "value": "INDORE",
884
-
885
- "hasDependentFields": false,
886
-
887
- "dependentFieldParentId": "mp1",
888
-
889
- "selectedParentId": "indre1",
890
-
891
- "groupOptions": [
892
-
893
- {
894
-
895
- "id": "indre1",
896
-
897
- "name": "INDORE",
898
-
899
- "value": "INDORE"
900
-
901
- },
902
-
903
- {
904
-
905
- "id": "bh1",
906
-
907
- "name": "bhopal",
908
-
909
- "value": "bhopal"
910
-
911
- }
912
-
913
- ],
914
-
915
- "dependentFields": [
916
-
917
-
918
-
919
- ]
920
-
921
- },
922
-
923
- {
924
-
925
- "formType": "simple",
926
-
927
- "fieldType": "select",
928
-
929
- "inputType": "select",
930
-
931
- "id": "upcity",
932
-
933
- "name": "select",
934
-
935
- "appearance": "outline",
936
-
937
- "label": "select City",
938
-
939
- "className": "select",
940
-
941
- "value": "",
942
-
943
- "hasDependentFields": false,
944
-
945
- "dependentFieldParentId": "up1",
946
-
947
- "groupOptions": [
948
-
949
- {
950
-
951
- "id": "m1",
952
-
953
- "name": "Mathura",
954
-
955
- "value": "Mathura"
956
-
957
- },
958
-
959
- {
960
-
961
- "id": "v1",
962
-
963
- "name": "Vrindavan",
964
-
965
- "value": "Vrindavan"
966
-
967
- }
968
-
969
- ],
970
-
971
- "dependentFields": [
972
-
973
-
974
-
975
- ]
976
-
977
- }
978
-
979
- ]
980
-
981
- },
982
-
983
- {
984
-
985
- "formType": "simple",
986
-
987
- "fieldType": "select",
988
-
989
- "inputType": "select",
990
-
991
- "id": "usaState",
992
-
993
- "name": "select",
994
-
995
- "appearance": "outline",
996
-
997
- "label": "select State",
998
-
999
- "className": "select",
1000
-
1001
- "value": "",
1002
-
1003
- "hasDependentFields": true,
1004
-
1005
- "dependentFieldParentId": "usa1",
1006
-
1007
- "groupOptions": [
1008
-
1009
- {
1010
-
1011
- "id": "p1",
1012
-
1013
- "name": "Phenix",
1014
-
1015
- "value": "Phenix"
1016
-
1017
- },
1018
-
1019
- {
1020
-
1021
- "id": "v1",
1022
-
1023
- "name": "Vasingtan",
1024
-
1025
- "value": "Vasingtan"
1026
-
1027
- }
1028
-
1029
- ],
1030
-
1031
- "dependentFields": [
1032
-
1033
- {
1034
-
1035
- "formType": "simple",
1036
-
1037
- "fieldType": "select",
1038
-
1039
- "inputType": "select",
1040
-
1041
- "id": "phinexCity",
1042
-
1043
- "name": "select",
1044
-
1045
- "appearance": "outline",
1046
-
1047
- "label": "select City",
1048
-
1049
- "className": "select",
1050
-
1051
- "value": "",
1052
-
1053
- "hasDependentFields": false,
1054
-
1055
- "dependentFieldParentId": "p1",
1056
-
1057
- "groupOptions": [
1058
-
1059
- {
1060
-
1061
- "id": "p11",
1062
-
1063
- "name": "p111",
1064
-
1065
- "value": "p111"
1066
-
1067
- },
1068
-
1069
- {
1070
-
1071
- "id": "p2",
1072
-
1073
- "name": "p222",
1074
-
1075
- "value": "p222"
1076
-
1077
- }
1078
-
1079
- ],
1080
-
1081
- "dependentFields": [
1082
-
1083
-
1084
-
1085
- ]
1086
-
1087
- },
1088
-
1089
- {
1090
-
1091
- "formType": "simple",
1092
-
1093
- "fieldType": "select",
1094
-
1095
- "inputType": "select",
1096
-
1097
- "id": "vashigtonCity",
1098
-
1099
- "name": "select",
1100
-
1101
- "appearance": "outline",
1102
-
1103
- "label": "select City",
1104
-
1105
- "className": "select",
1106
-
1107
- "value": "",
1108
-
1109
- "hasDependentFields": false,
1110
-
1111
- "dependentFieldParentId": "v1",
1112
-
1113
- "groupOptions": [
1114
-
1115
- {
1116
-
1117
- "id": "v11",
1118
-
1119
- "name": "v111",
1120
-
1121
- "value": "v111"
1122
-
1123
- },
1124
-
1125
- {
1126
-
1127
- "id": "v2",
1128
-
1129
- "name": "v222",
1130
-
1131
- "value": "v222"
1132
-
1133
- }
1134
-
1135
- ],
1136
-
1137
- "dependentFields": [
1138
-
1139
-
1140
-
1141
- ]
1142
-
1143
- }
1144
-
1145
- ]
1146
-
1147
- }
1148
-
1149
- ]
1150
-
1151
- }
1152
-
1153
- ]
1154
- beforeEach(async () => {
1155
- await TestBed.configureTestingModule({
1156
- declarations: [ RuclibMetaformComponent,
1157
- RucMetaInputsComponent,RucMetaRadioGroupComponent,RucMetaCheckboxGroupComponent,
1158
- RucMetaSelectComponent,RucTextAreaComponent
1159
- ],
1160
- imports: [HttpClientTestingModule, HttpClientModule,BrowserAnimationsModule,
1161
- FormsModule,
1162
- MatFormFieldModule,
1163
- MatInputModule,
1164
- MatRadioModule,
1165
- MatCheckboxModule,
1166
- MatSelectModule,
1167
- MatAutocompleteModule,
1168
- MatButtonModule,
1169
- MatTooltipModule,
1170
- TextFieldModule,
1171
- MatStepperModule],
1172
- providers: [
1173
- RucMetaFormService,
1174
- ],
1175
- })
1176
- .compileComponents();
1177
-
1178
- fixture = TestBed.createComponent(RuclibMetaformComponent);
1179
- component = fixture.componentInstance;
1180
- service = TestBed.inject(RucMetaFormService);
1181
- fixture.detectChanges();
1182
- component.dataSource = mockFormData;
1183
-
1184
- fixture.detectChanges();
1185
- });
1186
-
1187
- it('should create', fakeAsync(() => {
1188
- component.isChild = false;
1189
- spyOn(service, 'getFormJson').and.returnValue(of(mockFormData) as any); // Explicitly specify return type
1190
- fixture.detectChanges();
1191
- tick();
1192
- // Add another round of change detection to ensure any asynchronous tasks are completed
1193
- fixture.detectChanges();
1194
- tick();
1195
- expect(component).toBeTruthy();
1196
- }));
1197
-
1198
- it('should initialize as a child', () => {
1199
- // Set component properties to simulate being a child
1200
- component.isChild = true;
1201
- component.childForm = mockFormData;
1202
- // Call ngOnInit
1203
- component.ngOnInit();
1204
- expect(component.formData).toEqual(component.childForm);
1205
- });
1206
-
1207
- it('should called passEvent', () => {
1208
- component.dataSource = mockFormData;
1209
- const event = {
1210
- value: "Winter"
1211
- }
1212
- const spy= spyOn(component.rucEvent, 'emit');
1213
- component.passEvent(event, 1);
1214
-
1215
- expect(spy).toHaveBeenCalled();
1216
- });
1217
-
1218
- it('should called passEvent when upload something', () => {
1219
- component.dataSource = mockFormData;
1220
- const event = {
1221
- value: "file",
1222
- eventName: 'onUploading',
1223
- eventOutput: {
1224
- name: 'fileUpload'
1225
- }
1226
- }
1227
- const formElement = {value:''};
1228
- const spy= spyOn(component.rucEvent, 'emit');
1229
- component.passEvent(event,formElement);
1230
-
1231
- expect(spy).toHaveBeenCalled();
1232
- });
1233
-
1234
- it('should called getMetaFormData', () => {
1235
- component.dataSource = mockFormData;
1236
- const event = {
1237
- value: "Winter"
1238
- }
1239
- const spy= spyOn(component.rucEvent, 'emit');
1240
-
1241
- component.getMetaFormData(event);
1242
- expect(spy).toHaveBeenCalled();
1243
- });
1244
-
1245
- it('should clear form data', () => {
1246
- const testData: MetaFormConfig[] = mockFormData;
1247
- component.formData = testData;
1248
- component.clearForm();
1249
- component.formData.forEach((field: { value: any; }) => {
1250
- expect(field.value).toBe('');
1251
- });
1252
- });
1253
- });