@4science_ng-dynamic-forms/ui-ng-bootstrap 19.0.2 → 19.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.
- package/esm2022/lib/calendar/dynamic-ng-bootstrap-calendar.component.mjs +59 -0
- package/esm2022/lib/checkbox/dynamic-ng-bootstrap-checkbox.component.mjs +53 -0
- package/esm2022/lib/checkbox-group/dynamic-ng-bootstrap-checkbox-group.component.mjs +60 -0
- package/esm2022/lib/datepicker/dynamic-ng-bootstrap-datepicker.component.mjs +62 -0
- package/esm2022/lib/dynamic-ng-bootstrap-form-control-container.component.mjs +201 -0
- package/esm2022/lib/dynamic-ng-bootstrap-form.component.mjs +59 -0
- package/esm2022/lib/input/dynamic-ng-bootstrap-input.component.mjs +54 -0
- package/esm2022/lib/radio-group/dynamic-ng-bootstrap-radio-group.component.mjs +53 -0
- package/esm2022/lib/rating/dynamic-ng-bootstrap-rating.component.mjs +62 -0
- package/esm2022/lib/select/dynamic-ng-bootstrap-select.component.mjs +53 -0
- package/esm2022/lib/switch/dynamic-ng-bootstrap-switch.component.mjs +53 -0
- package/esm2022/lib/textarea/dynamic-ng-bootstrap-textarea.component.mjs +53 -0
- package/esm2022/lib/timepicker/dynamic-ng-bootstrap-timepicker.component.mjs +59 -0
- package/esm2022/lib/ui-ng-bootstrap.mjs +29 -0
- package/esm2022/public-api.mjs +17 -0
- package/esm2022/ui-ng-bootstrap.mjs +5 -0
- package/fesm2022/ui-ng-bootstrap.mjs +820 -0
- package/fesm2022/ui-ng-bootstrap.mjs.map +1 -0
- package/index.d.ts +5 -0
- package/lib/calendar/dynamic-ng-bootstrap-calendar.component.d.ts +21 -0
- package/lib/checkbox/dynamic-ng-bootstrap-checkbox.component.d.ts +18 -0
- package/lib/checkbox-group/dynamic-ng-bootstrap-checkbox-group.component.d.ts +20 -0
- package/lib/datepicker/dynamic-ng-bootstrap-datepicker.component.d.ts +22 -0
- package/lib/dynamic-ng-bootstrap-form-control-container.component.d.ts +65 -0
- package/lib/dynamic-ng-bootstrap-form.component.d.ts +21 -0
- package/lib/input/dynamic-ng-bootstrap-input.component.d.ts +18 -0
- package/lib/radio-group/dynamic-ng-bootstrap-radio-group.component.d.ts +18 -0
- package/lib/rating/dynamic-ng-bootstrap-rating.component.d.ts +22 -0
- package/lib/select/dynamic-ng-bootstrap-select.component.d.ts +18 -0
- package/lib/switch/dynamic-ng-bootstrap-switch.component.d.ts +18 -0
- package/lib/textarea/dynamic-ng-bootstrap-textarea.component.d.ts +18 -0
- package/lib/timepicker/dynamic-ng-bootstrap-timepicker.component.d.ts +21 -0
- package/{src/lib/ui-ng-bootstrap.ts → lib/ui-ng-bootstrap.d.ts} +0 -18
- package/package.json +15 -4
- package/public-api.d.ts +1 -0
- package/karma.conf.js +0 -52
- package/ng-package.json +0 -8
- package/src/lib/calendar/dynamic-ng-bootstrap-calendar.component.html +0 -33
- package/src/lib/calendar/dynamic-ng-bootstrap-calendar.component.spec.ts +0 -104
- package/src/lib/calendar/dynamic-ng-bootstrap-calendar.component.ts +0 -54
- package/src/lib/checkbox/dynamic-ng-bootstrap-checkbox.component.html +0 -38
- package/src/lib/checkbox/dynamic-ng-bootstrap-checkbox.component.spec.ts +0 -104
- package/src/lib/checkbox/dynamic-ng-bootstrap-checkbox.component.ts +0 -49
- package/src/lib/checkbox-group/dynamic-ng-bootstrap-checkbox-group.component.html +0 -42
- package/src/lib/checkbox-group/dynamic-ng-bootstrap-checkbox-group.component.spec.ts +0 -108
- package/src/lib/checkbox-group/dynamic-ng-bootstrap-checkbox-group.component.ts +0 -59
- package/src/lib/datepicker/dynamic-ng-bootstrap-datepicker.component.html +0 -51
- package/src/lib/datepicker/dynamic-ng-bootstrap-datepicker.component.spec.ts +0 -103
- package/src/lib/datepicker/dynamic-ng-bootstrap-datepicker.component.ts +0 -56
- package/src/lib/dynamic-ng-bootstrap-form-array.component.html +0 -45
- package/src/lib/dynamic-ng-bootstrap-form-control-container.component.html +0 -44
- package/src/lib/dynamic-ng-bootstrap-form-control-container.component.spec.ts +0 -198
- package/src/lib/dynamic-ng-bootstrap-form-control-container.component.ts +0 -214
- package/src/lib/dynamic-ng-bootstrap-form-group.component.html +0 -35
- package/src/lib/dynamic-ng-bootstrap-form.component.html +0 -26
- package/src/lib/dynamic-ng-bootstrap-form.component.ts +0 -65
- package/src/lib/input/dynamic-ng-bootstrap-input.component.html +0 -101
- package/src/lib/input/dynamic-ng-bootstrap-input.component.spec.ts +0 -107
- package/src/lib/input/dynamic-ng-bootstrap-input.component.ts +0 -52
- package/src/lib/radio-group/dynamic-ng-bootstrap-radio-group.component.html +0 -42
- package/src/lib/radio-group/dynamic-ng-bootstrap-radio-group.component.spec.ts +0 -106
- package/src/lib/radio-group/dynamic-ng-bootstrap-radio-group.component.ts +0 -49
- package/src/lib/rating/dynamic-ng-bootstrap-rating.component.html +0 -28
- package/src/lib/rating/dynamic-ng-bootstrap-rating.component.spec.ts +0 -104
- package/src/lib/rating/dynamic-ng-bootstrap-rating.component.ts +0 -56
- package/src/lib/select/dynamic-ng-bootstrap-select.component.html +0 -39
- package/src/lib/select/dynamic-ng-bootstrap-select.component.spec.ts +0 -104
- package/src/lib/select/dynamic-ng-bootstrap-select.component.ts +0 -49
- package/src/lib/switch/dynamic-ng-bootstrap-switch.component.html +0 -35
- package/src/lib/switch/dynamic-ng-bootstrap-switch.component.spec.ts +0 -104
- package/src/lib/switch/dynamic-ng-bootstrap-switch.component.ts +0 -49
- package/src/lib/textarea/dynamic-ng-bootstrap-textarea.component.html +0 -39
- package/src/lib/textarea/dynamic-ng-bootstrap-textarea.component.spec.ts +0 -105
- package/src/lib/textarea/dynamic-ng-bootstrap-textarea.component.ts +0 -49
- package/src/lib/timepicker/dynamic-ng-bootstrap-timepicker.component.html +0 -30
- package/src/lib/timepicker/dynamic-ng-bootstrap-timepicker.component.spec.ts +0 -111
- package/src/lib/timepicker/dynamic-ng-bootstrap-timepicker.component.ts +0 -54
- package/src/public-api.ts +0 -17
- package/src/test.ts +0 -35
- package/tsconfig.lib.json +0 -30
- package/tsconfig.lib.prod.json +0 -9
- package/tsconfig.spec.json +0 -17
- package/tslint.json +0 -17
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright (c) 2016-2021, Udo Schöfer http://www.udos86.de
|
|
3
|
-
*
|
|
4
|
-
* Permission to use, copy, modify, and/or distribute this software for any
|
|
5
|
-
* purpose with or without fee is hereby granted, provided that the above
|
|
6
|
-
* copyright notice and this permission notice appear in all copies.
|
|
7
|
-
*
|
|
8
|
-
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
9
|
-
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
10
|
-
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
11
|
-
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
12
|
-
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
13
|
-
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
14
|
-
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
15
|
-
*/
|
|
16
|
-
|
|
17
|
-
import { TestBed, inject, ComponentFixture, waitForAsync } from "@angular/core/testing";
|
|
18
|
-
import { DebugElement } from "@angular/core";
|
|
19
|
-
import { ReactiveFormsModule, UntypedFormGroup } from "@angular/forms";
|
|
20
|
-
import { NoopAnimationsModule } from "@angular/platform-browser/animations";
|
|
21
|
-
import { By } from "@angular/platform-browser";
|
|
22
|
-
import { DynamicCheckboxGroupModel, DynamicFormsCoreModule, DynamicFormService } from "@ng-dynamic-forms/core";
|
|
23
|
-
import { DynamicNGBootstrapCheckboxGroupComponent } from "./dynamic-ng-bootstrap-checkbox-group.component";
|
|
24
|
-
|
|
25
|
-
describe("DynamicNGBootstrapCheckboxGroupComponent test suite", () => {
|
|
26
|
-
const testModel = new DynamicCheckboxGroupModel({id: "checkboxGroup", group: []});
|
|
27
|
-
const formModel = [testModel];
|
|
28
|
-
|
|
29
|
-
let formGroup: UntypedFormGroup;
|
|
30
|
-
let fixture: ComponentFixture<DynamicNGBootstrapCheckboxGroupComponent>;
|
|
31
|
-
let component: DynamicNGBootstrapCheckboxGroupComponent;
|
|
32
|
-
let debugElement: DebugElement;
|
|
33
|
-
let testElement: DebugElement;
|
|
34
|
-
|
|
35
|
-
beforeEach(waitForAsync(() => {
|
|
36
|
-
TestBed.configureTestingModule({
|
|
37
|
-
imports: [
|
|
38
|
-
ReactiveFormsModule,
|
|
39
|
-
NoopAnimationsModule,
|
|
40
|
-
DynamicFormsCoreModule,
|
|
41
|
-
DynamicNGBootstrapCheckboxGroupComponent
|
|
42
|
-
]
|
|
43
|
-
}).compileComponents().then(() => {
|
|
44
|
-
fixture = TestBed.createComponent(DynamicNGBootstrapCheckboxGroupComponent);
|
|
45
|
-
|
|
46
|
-
component = fixture.componentInstance;
|
|
47
|
-
debugElement = fixture.debugElement;
|
|
48
|
-
});
|
|
49
|
-
}));
|
|
50
|
-
|
|
51
|
-
beforeEach(inject([DynamicFormService], (service: DynamicFormService) => {
|
|
52
|
-
formGroup = service.createFormGroup(formModel);
|
|
53
|
-
|
|
54
|
-
component.group = formGroup;
|
|
55
|
-
component.model = testModel;
|
|
56
|
-
|
|
57
|
-
fixture.detectChanges();
|
|
58
|
-
|
|
59
|
-
testElement = debugElement.query(By.css(`div.btn-group`));
|
|
60
|
-
}));
|
|
61
|
-
|
|
62
|
-
it("should initialize correctly", () => {
|
|
63
|
-
expect(component.control instanceof UntypedFormGroup).toBe(true);
|
|
64
|
-
expect(component.group instanceof UntypedFormGroup).toBe(true);
|
|
65
|
-
expect(component.model instanceof DynamicCheckboxGroupModel).toBe(true);
|
|
66
|
-
|
|
67
|
-
expect(component.blur).toBeDefined();
|
|
68
|
-
expect(component.change).toBeDefined();
|
|
69
|
-
expect(component.focus).toBeDefined();
|
|
70
|
-
|
|
71
|
-
expect(component.onBlur).toBeDefined();
|
|
72
|
-
expect(component.onChange).toBeDefined();
|
|
73
|
-
expect(component.onFocus).toBeDefined();
|
|
74
|
-
|
|
75
|
-
expect(component.hasFocus).toBe(false);
|
|
76
|
-
expect(component.isValid).toBe(true);
|
|
77
|
-
expect(component.isInvalid).toBe(false);
|
|
78
|
-
expect(component.showErrorMessages).toBe(false);
|
|
79
|
-
});
|
|
80
|
-
|
|
81
|
-
it("should have an div.btn-group element", () => {
|
|
82
|
-
expect(testElement instanceof DebugElement).toBe(true);
|
|
83
|
-
});
|
|
84
|
-
|
|
85
|
-
it("should emit blur event", () => {
|
|
86
|
-
spyOn(component.blur, "emit");
|
|
87
|
-
|
|
88
|
-
component.onBlur(null);
|
|
89
|
-
|
|
90
|
-
expect(component.blur.emit).toHaveBeenCalled();
|
|
91
|
-
});
|
|
92
|
-
|
|
93
|
-
it("should emit change event", () => {
|
|
94
|
-
spyOn(component.change, "emit");
|
|
95
|
-
|
|
96
|
-
component.onChange(null);
|
|
97
|
-
|
|
98
|
-
expect(component.change.emit).toHaveBeenCalled();
|
|
99
|
-
});
|
|
100
|
-
|
|
101
|
-
it("should emit focus event", () => {
|
|
102
|
-
spyOn(component.focus, "emit");
|
|
103
|
-
|
|
104
|
-
component.onFocus(null);
|
|
105
|
-
|
|
106
|
-
expect(component.focus.emit).toHaveBeenCalled();
|
|
107
|
-
});
|
|
108
|
-
});
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright (c) 2016-2021, Udo Schöfer http://www.udos86.de
|
|
3
|
-
*
|
|
4
|
-
* Permission to use, copy, modify, and/or distribute this software for any
|
|
5
|
-
* purpose with or without fee is hereby granted, provided that the above
|
|
6
|
-
* copyright notice and this permission notice appear in all copies.
|
|
7
|
-
*
|
|
8
|
-
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
9
|
-
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
10
|
-
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
11
|
-
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
12
|
-
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
13
|
-
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
14
|
-
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
15
|
-
*/
|
|
16
|
-
|
|
17
|
-
import { ChangeDetectionStrategy, Component, EventEmitter, Input, Output } from "@angular/core";
|
|
18
|
-
import { UntypedFormGroup, ReactiveFormsModule } from "@angular/forms";
|
|
19
|
-
import {
|
|
20
|
-
DynamicCheckboxGroupModel,
|
|
21
|
-
DynamicCheckboxModel,
|
|
22
|
-
DynamicFormControlComponent,
|
|
23
|
-
DynamicFormControlLayout,
|
|
24
|
-
DynamicFormLayout,
|
|
25
|
-
DynamicFormLayoutService,
|
|
26
|
-
DynamicFormValidationService
|
|
27
|
-
} from "@ng-dynamic-forms/core";
|
|
28
|
-
import { NgClass, NgFor } from "@angular/common";
|
|
29
|
-
|
|
30
|
-
@Component({
|
|
31
|
-
selector: "dynamic-ng-bootstrap-checkbox-group",
|
|
32
|
-
templateUrl: "./dynamic-ng-bootstrap-checkbox-group.component.html",
|
|
33
|
-
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
34
|
-
standalone: true,
|
|
35
|
-
imports: [ReactiveFormsModule, NgClass, NgFor]
|
|
36
|
-
})
|
|
37
|
-
export class DynamicNGBootstrapCheckboxGroupComponent extends DynamicFormControlComponent {
|
|
38
|
-
@Input() formLayout?: DynamicFormLayout;
|
|
39
|
-
@Input() group!: UntypedFormGroup;
|
|
40
|
-
@Input() layout?: DynamicFormControlLayout;
|
|
41
|
-
@Input() model!: DynamicCheckboxGroupModel;
|
|
42
|
-
|
|
43
|
-
@Output() blur: EventEmitter<any> = new EventEmitter();
|
|
44
|
-
@Output() change: EventEmitter<any> = new EventEmitter();
|
|
45
|
-
@Output() focus: EventEmitter<any> = new EventEmitter();
|
|
46
|
-
|
|
47
|
-
constructor(protected layoutService: DynamicFormLayoutService, protected validationService: DynamicFormValidationService) {
|
|
48
|
-
super(layoutService, validationService);
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
getCheckboxId(model: DynamicCheckboxModel) {
|
|
52
|
-
return this.layoutService.getElementId(model);
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
onCheckboxChange($event: Event, model: DynamicCheckboxModel) {
|
|
56
|
-
this.onChange($event);
|
|
57
|
-
model.value = ($event.target as HTMLInputElement).checked;
|
|
58
|
-
}
|
|
59
|
-
}
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
<!--
|
|
2
|
-
~ Copyright (c) 2016-2021, Udo Schöfer http://www.udos86.de
|
|
3
|
-
~
|
|
4
|
-
~ Permission to use, copy, modify, and/or distribute this software for any
|
|
5
|
-
~ purpose with or without fee is hereby granted, provided that the above
|
|
6
|
-
~ copyright notice and this permission notice appear in all copies.
|
|
7
|
-
~
|
|
8
|
-
~ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
9
|
-
~ WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
10
|
-
~ MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
11
|
-
~ ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
12
|
-
~ WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
13
|
-
~ ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
14
|
-
~ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
15
|
-
-->
|
|
16
|
-
|
|
17
|
-
<div [formGroup]="group" class="input-group">
|
|
18
|
-
|
|
19
|
-
<input ngbDatepicker class="form-control" #datepicker="ngbDatepicker"
|
|
20
|
-
[class.is-invalid]="showErrorMessages"
|
|
21
|
-
[displayMonths]="model.getAdditional('displayMonths', config['displayMonths'])"
|
|
22
|
-
[firstDayOfWeek]="model.getAdditional('firstDayOfWeek', config['firstDayOfWeek'])"
|
|
23
|
-
[formControlName]="model.id"
|
|
24
|
-
[id]="id"
|
|
25
|
-
[maxDate]="model.max"
|
|
26
|
-
[minDate]="model.min"
|
|
27
|
-
[name]="model.name"
|
|
28
|
-
[navigation]="model.getAdditional('navigation', config['navigation'])"
|
|
29
|
-
[ngClass]="getClass('element', 'control')"
|
|
30
|
-
[outsideDays]="model.getAdditional('outsideDays', config['outsideDays'])"
|
|
31
|
-
[placeholder]="model.placeholder"
|
|
32
|
-
[placement]="model.getAdditional('placement', 'bottom-left')"
|
|
33
|
-
[showWeekNumbers]="model.getAdditional('showWeekNumbers', config['showWeekNumbers'])"
|
|
34
|
-
[startDate]="model.focusedDate"
|
|
35
|
-
[weekdays]="model.getAdditional('weekdays', config['weekdays'])"
|
|
36
|
-
(blur)="onBlur($event)"
|
|
37
|
-
(dateSelect)="onCustomEvent($event, 'dateSelect')"
|
|
38
|
-
(closed)="onCustomEvent($event, 'closed')"
|
|
39
|
-
(change)="onChange($event)"
|
|
40
|
-
(focus)="onFocus($event)">
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
<button class="btn btn-outline-secondary" type="button" (click)="datepicker.toggle()">
|
|
44
|
-
|
|
45
|
-
<img *ngIf="model.toggleIcon" [src]="model.toggleIcon" style="cursor: pointer;"/>
|
|
46
|
-
<span *ngIf="model.toggleLabel">{{ model.toggleLabel }}</span>
|
|
47
|
-
|
|
48
|
-
</button>
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
</div>
|
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright (c) 2016-2021, Udo Schöfer http://www.udos86.de
|
|
3
|
-
*
|
|
4
|
-
* Permission to use, copy, modify, and/or distribute this software for any
|
|
5
|
-
* purpose with or without fee is hereby granted, provided that the above
|
|
6
|
-
* copyright notice and this permission notice appear in all copies.
|
|
7
|
-
*
|
|
8
|
-
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
9
|
-
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
10
|
-
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
11
|
-
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
12
|
-
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
13
|
-
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
14
|
-
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
15
|
-
*/
|
|
16
|
-
|
|
17
|
-
import { TestBed, inject, ComponentFixture, waitForAsync } from "@angular/core/testing";
|
|
18
|
-
import { DebugElement } from "@angular/core";
|
|
19
|
-
import { UntypedFormGroup, UntypedFormControl } from "@angular/forms";
|
|
20
|
-
import { By } from "@angular/platform-browser";
|
|
21
|
-
import { DynamicDatePickerModel, DynamicFormService } from "@ng-dynamic-forms/core";
|
|
22
|
-
import { DynamicNGBootstrapDatePickerComponent } from "./dynamic-ng-bootstrap-datepicker.component";
|
|
23
|
-
|
|
24
|
-
describe("DynamicNGBootstrapDatePickerComponent test suite", () => {
|
|
25
|
-
const testModel = new DynamicDatePickerModel({id: "datepicker"});
|
|
26
|
-
const formModel = [testModel];
|
|
27
|
-
|
|
28
|
-
let formGroup: UntypedFormGroup;
|
|
29
|
-
let fixture: ComponentFixture<DynamicNGBootstrapDatePickerComponent>;
|
|
30
|
-
let component: DynamicNGBootstrapDatePickerComponent;
|
|
31
|
-
let debugElement: DebugElement;
|
|
32
|
-
let testElement: DebugElement;
|
|
33
|
-
|
|
34
|
-
beforeEach(waitForAsync(() => {
|
|
35
|
-
TestBed.configureTestingModule({
|
|
36
|
-
imports: [DynamicNGBootstrapDatePickerComponent]
|
|
37
|
-
}).compileComponents().then(() => {
|
|
38
|
-
fixture = TestBed.createComponent(DynamicNGBootstrapDatePickerComponent);
|
|
39
|
-
|
|
40
|
-
component = fixture.componentInstance;
|
|
41
|
-
debugElement = fixture.debugElement;
|
|
42
|
-
});
|
|
43
|
-
}));
|
|
44
|
-
|
|
45
|
-
beforeEach(inject([DynamicFormService], (service: DynamicFormService) => {
|
|
46
|
-
formGroup = service.createFormGroup(formModel);
|
|
47
|
-
|
|
48
|
-
component.group = formGroup;
|
|
49
|
-
component.model = testModel;
|
|
50
|
-
|
|
51
|
-
fixture.detectChanges();
|
|
52
|
-
|
|
53
|
-
testElement = debugElement.query(By.css(`input[id="${testModel.id}"]`));
|
|
54
|
-
}));
|
|
55
|
-
|
|
56
|
-
it("should initialize correctly", () => {
|
|
57
|
-
expect(component.control instanceof UntypedFormControl).toBe(true);
|
|
58
|
-
expect(component.group instanceof UntypedFormGroup).toBe(true);
|
|
59
|
-
expect(component.model instanceof DynamicDatePickerModel).toBe(true);
|
|
60
|
-
// expect(component.ngbDatePicker instanceof NgbDatepicker).toBe(true);
|
|
61
|
-
|
|
62
|
-
expect(component.blur).toBeDefined();
|
|
63
|
-
expect(component.change).toBeDefined();
|
|
64
|
-
expect(component.focus).toBeDefined();
|
|
65
|
-
|
|
66
|
-
expect(component.onBlur).toBeDefined();
|
|
67
|
-
expect(component.onChange).toBeDefined();
|
|
68
|
-
expect(component.onFocus).toBeDefined();
|
|
69
|
-
|
|
70
|
-
expect(component.hasFocus).toBe(false);
|
|
71
|
-
expect(component.isValid).toBe(true);
|
|
72
|
-
expect(component.isInvalid).toBe(false);
|
|
73
|
-
expect(component.showErrorMessages).toBe(false);
|
|
74
|
-
});
|
|
75
|
-
|
|
76
|
-
it("should have an input element", () => {
|
|
77
|
-
expect(testElement instanceof DebugElement).toBe(true);
|
|
78
|
-
});
|
|
79
|
-
|
|
80
|
-
it("should emit blur event", () => {
|
|
81
|
-
spyOn(component.blur, "emit");
|
|
82
|
-
|
|
83
|
-
component.onBlur(null);
|
|
84
|
-
|
|
85
|
-
expect(component.blur.emit).toHaveBeenCalled();
|
|
86
|
-
});
|
|
87
|
-
|
|
88
|
-
it("should emit change event", () => {
|
|
89
|
-
spyOn(component.change, "emit");
|
|
90
|
-
|
|
91
|
-
component.onChange(null);
|
|
92
|
-
|
|
93
|
-
expect(component.change.emit).toHaveBeenCalled();
|
|
94
|
-
});
|
|
95
|
-
|
|
96
|
-
it("should emit focus event", () => {
|
|
97
|
-
spyOn(component.focus, "emit");
|
|
98
|
-
|
|
99
|
-
component.onFocus(null);
|
|
100
|
-
|
|
101
|
-
expect(component.focus.emit).toHaveBeenCalled();
|
|
102
|
-
});
|
|
103
|
-
});
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright (c) 2016-2021, Udo Schöfer http://www.udos86.de
|
|
3
|
-
*
|
|
4
|
-
* Permission to use, copy, modify, and/or distribute this software for any
|
|
5
|
-
* purpose with or without fee is hereby granted, provided that the above
|
|
6
|
-
* copyright notice and this permission notice appear in all copies.
|
|
7
|
-
*
|
|
8
|
-
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
9
|
-
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
10
|
-
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
11
|
-
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
12
|
-
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
13
|
-
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
14
|
-
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
15
|
-
*/
|
|
16
|
-
|
|
17
|
-
import { ChangeDetectionStrategy, Component, EventEmitter, Input, Output, ViewChild } from "@angular/core";
|
|
18
|
-
import { UntypedFormGroup, ReactiveFormsModule } from "@angular/forms";
|
|
19
|
-
import { NgbDatepicker, NgbDatepickerConfig, NgbDatepickerModule } from "@ng-bootstrap/ng-bootstrap";
|
|
20
|
-
import {
|
|
21
|
-
DynamicDatePickerModel,
|
|
22
|
-
DynamicFormControlComponent,
|
|
23
|
-
DynamicFormControlCustomEvent,
|
|
24
|
-
DynamicFormControlLayout,
|
|
25
|
-
DynamicFormLayout,
|
|
26
|
-
DynamicFormLayoutService,
|
|
27
|
-
DynamicFormValidationService
|
|
28
|
-
} from "@ng-dynamic-forms/core";
|
|
29
|
-
import { NgClass, NgIf } from "@angular/common";
|
|
30
|
-
|
|
31
|
-
@Component({
|
|
32
|
-
selector: "dynamic-ng-bootstrap-datepicker",
|
|
33
|
-
templateUrl: "./dynamic-ng-bootstrap-datepicker.component.html",
|
|
34
|
-
changeDetection: ChangeDetectionStrategy.Default,
|
|
35
|
-
standalone: true,
|
|
36
|
-
imports: [ReactiveFormsModule, NgbDatepickerModule, NgClass, NgIf]
|
|
37
|
-
})
|
|
38
|
-
export class DynamicNGBootstrapDatePickerComponent extends DynamicFormControlComponent {
|
|
39
|
-
@Input() formLayout?: DynamicFormLayout;
|
|
40
|
-
@Input() group!: UntypedFormGroup;
|
|
41
|
-
@Input() layout?: DynamicFormControlLayout;
|
|
42
|
-
@Input() model!: DynamicDatePickerModel;
|
|
43
|
-
|
|
44
|
-
@Output() blur: EventEmitter<any> = new EventEmitter();
|
|
45
|
-
@Output() change: EventEmitter<any> = new EventEmitter();
|
|
46
|
-
@Output() customEvent: EventEmitter<DynamicFormControlCustomEvent> = new EventEmitter();
|
|
47
|
-
@Output() focus: EventEmitter<any> = new EventEmitter();
|
|
48
|
-
|
|
49
|
-
@ViewChild(NgbDatepicker) ngbDatePicker!: NgbDatepicker;
|
|
50
|
-
|
|
51
|
-
constructor(protected layoutService: DynamicFormLayoutService,
|
|
52
|
-
protected validationService: DynamicFormValidationService,
|
|
53
|
-
public config: NgbDatepickerConfig) {
|
|
54
|
-
super(layoutService, validationService);
|
|
55
|
-
}
|
|
56
|
-
}
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
<!--
|
|
2
|
-
~ Copyright (c) 2016-2021, Udo Schöfer http://www.udos86.de
|
|
3
|
-
~
|
|
4
|
-
~ Permission to use, copy, modify, and/or distribute this software for any
|
|
5
|
-
~ purpose with or without fee is hereby granted, provided that the above
|
|
6
|
-
~ copyright notice and this permission notice appear in all copies.
|
|
7
|
-
~
|
|
8
|
-
~ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
9
|
-
~ WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
10
|
-
~ MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
11
|
-
~ ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
12
|
-
~ WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
13
|
-
~ ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
14
|
-
~ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
15
|
-
-->
|
|
16
|
-
|
|
17
|
-
<ng-container [formGroup]="group">
|
|
18
|
-
|
|
19
|
-
<div [formArrayName]="model.id" [id]="id" [ngClass]="getClass('element', 'control')">
|
|
20
|
-
|
|
21
|
-
<div *ngFor="let groupModel of model.groups; let idx = index" role="group"
|
|
22
|
-
[formGroupName]="idx" [ngClass]="[getClass('element', 'group'), getClass('grid', 'group')]">
|
|
23
|
-
|
|
24
|
-
<ng-container *ngTemplateOutlet="startTemplate?.templateRef; context: groupModel"></ng-container>
|
|
25
|
-
|
|
26
|
-
<dynamic-ng-bootstrap-form-control *ngFor="let _model of groupModel.group"
|
|
27
|
-
[context]="groupModel"
|
|
28
|
-
[group]="array.at(idx)"
|
|
29
|
-
[hidden]="_model.hidden"
|
|
30
|
-
[layout]="formLayout"
|
|
31
|
-
[model]="_model"
|
|
32
|
-
[templates]="templates"
|
|
33
|
-
[hostClass]="[getClass('element','children'), getClass('grid','children')]"
|
|
34
|
-
(blur)="onBlur($event)"
|
|
35
|
-
(change)="onChange($event)"
|
|
36
|
-
(focus)="onFocus($event)"
|
|
37
|
-
(ngbEvent)="onCustomEvent($event, null, true)"></dynamic-ng-bootstrap-form-control>
|
|
38
|
-
|
|
39
|
-
<ng-container *ngTemplateOutlet="endTemplate?.templateRef; context: groupModel"></ng-container>
|
|
40
|
-
|
|
41
|
-
</div>
|
|
42
|
-
|
|
43
|
-
</div>
|
|
44
|
-
|
|
45
|
-
</ng-container>
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
<!--
|
|
2
|
-
~ Copyright (c) 2016-2021, Udo Schöfer http://www.udos86.de
|
|
3
|
-
~
|
|
4
|
-
~ Permission to use, copy, modify, and/or distribute this software for any
|
|
5
|
-
~ purpose with or without fee is hereby granted, provided that the above
|
|
6
|
-
~ copyright notice and this permission notice appear in all copies.
|
|
7
|
-
~
|
|
8
|
-
~ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
9
|
-
~ WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
10
|
-
~ MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
11
|
-
~ ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
12
|
-
~ WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
13
|
-
~ ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
14
|
-
~ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
15
|
-
-->
|
|
16
|
-
|
|
17
|
-
<div [class.mb-3]="(model.type !== 'GROUP' && asBootstrapFormGroup) || getClass('element', 'container').includes('form-group')"
|
|
18
|
-
[formGroup]="group"
|
|
19
|
-
[ngClass]="['ng-dynamic-forms-'+model.type.toLowerCase(), getClass('element', 'container'), getClass('grid', 'container')]">
|
|
20
|
-
|
|
21
|
-
<label *ngIf="!isCheckbox && hasLabel"
|
|
22
|
-
[for]="id"
|
|
23
|
-
[innerHTML]="model.label"
|
|
24
|
-
[ngClass]="[getClass('element', 'label'), getClass('grid', 'label')]"></label>
|
|
25
|
-
|
|
26
|
-
<ng-container *ngTemplateOutlet="startTemplate?.templateRef; context: model"></ng-container>
|
|
27
|
-
|
|
28
|
-
<div [ngClass]="getClass('grid', 'control')">
|
|
29
|
-
|
|
30
|
-
<ng-container #componentViewContainer></ng-container>
|
|
31
|
-
|
|
32
|
-
<small *ngIf="hasHint" class="text-muted" [innerHTML]="hint" [ngClass]="getClass('element', 'hint')"></small>
|
|
33
|
-
|
|
34
|
-
<div *ngIf="showErrorMessages" [ngClass]="[getClass('element', 'errors'), getClass('grid', 'errors')]">
|
|
35
|
-
<small *ngFor="let message of errorMessages" class="invalid-feedback d-block">{{ message }}</small>
|
|
36
|
-
</div>
|
|
37
|
-
|
|
38
|
-
</div>
|
|
39
|
-
|
|
40
|
-
<ng-container *ngTemplateOutlet="endTemplate?.templateRef; context: model"></ng-container>
|
|
41
|
-
|
|
42
|
-
<ng-content></ng-content>
|
|
43
|
-
|
|
44
|
-
</div>
|
|
@@ -1,198 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright (c) 2016-2021, Udo Schöfer http://www.udos86.de
|
|
3
|
-
*
|
|
4
|
-
* Permission to use, copy, modify, and/or distribute this software for any
|
|
5
|
-
* purpose with or without fee is hereby granted, provided that the above
|
|
6
|
-
* copyright notice and this permission notice appear in all copies.
|
|
7
|
-
*
|
|
8
|
-
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
9
|
-
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
10
|
-
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
11
|
-
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
12
|
-
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
13
|
-
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
14
|
-
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
15
|
-
*/
|
|
16
|
-
|
|
17
|
-
import { TestBed, inject, ComponentFixture, waitForAsync } from "@angular/core/testing";
|
|
18
|
-
import { DebugElement, SimpleChange } from "@angular/core";
|
|
19
|
-
import { UntypedFormGroup, UntypedFormControl } from "@angular/forms";
|
|
20
|
-
import { By } from "@angular/platform-browser";
|
|
21
|
-
import { provideNgxMask } from "ngx-mask";
|
|
22
|
-
import {
|
|
23
|
-
DynamicFormService,
|
|
24
|
-
DynamicCheckboxModel,
|
|
25
|
-
DynamicCheckboxGroupModel,
|
|
26
|
-
DynamicColorPickerModel,
|
|
27
|
-
DynamicDatePickerModel,
|
|
28
|
-
DynamicEditorModel,
|
|
29
|
-
DynamicFileUploadModel,
|
|
30
|
-
DynamicFormArrayModel,
|
|
31
|
-
DynamicFormControlModel,
|
|
32
|
-
DynamicFormGroupModel,
|
|
33
|
-
DynamicInputModel,
|
|
34
|
-
DynamicRadioGroupModel,
|
|
35
|
-
DynamicRatingModel,
|
|
36
|
-
DynamicSelectModel,
|
|
37
|
-
DynamicSliderModel,
|
|
38
|
-
DynamicSwitchModel,
|
|
39
|
-
DynamicTextAreaModel,
|
|
40
|
-
DynamicTimePickerModel
|
|
41
|
-
} from "@ng-dynamic-forms/core";
|
|
42
|
-
import {
|
|
43
|
-
DynamicNGBootstrapFormArrayComponent,
|
|
44
|
-
DynamicNGBootstrapFormControlContainerComponent,
|
|
45
|
-
DynamicNGBootstrapFormGroupComponent,
|
|
46
|
-
ngBootstrapUIFormControlMapFn
|
|
47
|
-
} from "./dynamic-ng-bootstrap-form-control-container.component";
|
|
48
|
-
import { DynamicNGBootstrapCheckboxComponent } from "./checkbox/dynamic-ng-bootstrap-checkbox.component";
|
|
49
|
-
import { DynamicNGBootstrapCheckboxGroupComponent } from "./checkbox-group/dynamic-ng-bootstrap-checkbox-group.component";
|
|
50
|
-
import { DynamicNGBootstrapDatePickerComponent } from "./datepicker/dynamic-ng-bootstrap-datepicker.component";
|
|
51
|
-
import { DynamicNGBootstrapInputComponent } from "./input/dynamic-ng-bootstrap-input.component";
|
|
52
|
-
import { DynamicNGBootstrapRadioGroupComponent } from "./radio-group/dynamic-ng-bootstrap-radio-group.component";
|
|
53
|
-
import { DynamicNGBootstrapRatingComponent } from "./rating/dynamic-ng-bootstrap-rating.component";
|
|
54
|
-
import { DynamicNGBootstrapSelectComponent } from "./select/dynamic-ng-bootstrap-select.component";
|
|
55
|
-
import { DynamicNGBootstrapSwitchComponent } from "./switch/dynamic-ng-bootstrap-switch.component";
|
|
56
|
-
import { DynamicNGBootstrapTextAreaComponent } from "./textarea/dynamic-ng-bootstrap-textarea.component";
|
|
57
|
-
import { DynamicNGBootstrapTimePickerComponent } from "./timepicker/dynamic-ng-bootstrap-timepicker.component";
|
|
58
|
-
|
|
59
|
-
describe("DynamicNGBootstrapFormControlContainerComponent test suite", () => {
|
|
60
|
-
const inputModel = new DynamicInputModel({id: "input", maxLength: 51});
|
|
61
|
-
const formModel = [
|
|
62
|
-
new DynamicCheckboxModel({id: "checkbox"}),
|
|
63
|
-
new DynamicCheckboxGroupModel({id: "checkboxGroup", group: []}),
|
|
64
|
-
new DynamicColorPickerModel({id: "colorpicker"}),
|
|
65
|
-
new DynamicDatePickerModel({id: "datepicker"}),
|
|
66
|
-
new DynamicEditorModel({id: "editor"}),
|
|
67
|
-
new DynamicFileUploadModel({id: "upload", url: ""}),
|
|
68
|
-
new DynamicFormArrayModel({id: "formArray", groupFactory: () => []}),
|
|
69
|
-
new DynamicFormGroupModel({id: "formGroup", group: []}),
|
|
70
|
-
inputModel,
|
|
71
|
-
new DynamicRadioGroupModel({id: "radioGroup"}),
|
|
72
|
-
new DynamicRatingModel({id: "rating"}),
|
|
73
|
-
new DynamicSelectModel({id: "select", options: [{value: "One"}, {value: "Two"}], value: "One"}),
|
|
74
|
-
new DynamicSliderModel({id: "slider"}),
|
|
75
|
-
new DynamicSwitchModel({id: "switch"}),
|
|
76
|
-
new DynamicTextAreaModel({id: "textarea"}),
|
|
77
|
-
new DynamicTimePickerModel({id: "timepicker"})
|
|
78
|
-
];
|
|
79
|
-
|
|
80
|
-
let formGroup: UntypedFormGroup;
|
|
81
|
-
let fixture: ComponentFixture<DynamicNGBootstrapFormControlContainerComponent>;
|
|
82
|
-
let component: DynamicNGBootstrapFormControlContainerComponent;
|
|
83
|
-
let debugElement: DebugElement;
|
|
84
|
-
let testElement: DebugElement;
|
|
85
|
-
|
|
86
|
-
beforeEach(waitForAsync(() => {
|
|
87
|
-
TestBed.configureTestingModule({
|
|
88
|
-
imports: [DynamicNGBootstrapFormControlContainerComponent, DynamicNGBootstrapInputComponent],
|
|
89
|
-
providers: [provideNgxMask()]
|
|
90
|
-
}).compileComponents().then(() => {
|
|
91
|
-
fixture = TestBed.createComponent(DynamicNGBootstrapFormControlContainerComponent);
|
|
92
|
-
|
|
93
|
-
component = fixture.componentInstance;
|
|
94
|
-
debugElement = fixture.debugElement;
|
|
95
|
-
});
|
|
96
|
-
}));
|
|
97
|
-
|
|
98
|
-
beforeEach(inject([DynamicFormService], (service: DynamicFormService) => {
|
|
99
|
-
formGroup = service.createFormGroup(formModel);
|
|
100
|
-
|
|
101
|
-
component.group = formGroup;
|
|
102
|
-
component.model = inputModel;
|
|
103
|
-
|
|
104
|
-
component.ngOnChanges({
|
|
105
|
-
group: new SimpleChange(null, component.group, true),
|
|
106
|
-
model: new SimpleChange(null, component.model, true)
|
|
107
|
-
});
|
|
108
|
-
|
|
109
|
-
fixture.detectChanges();
|
|
110
|
-
|
|
111
|
-
testElement = debugElement.query(By.css(`input[id='${inputModel.id}']`));
|
|
112
|
-
}));
|
|
113
|
-
|
|
114
|
-
it("should initialize correctly", () => {
|
|
115
|
-
expect(component.asBootstrapFormGroup).toBe(true);
|
|
116
|
-
expect(component.context).toBeNull();
|
|
117
|
-
expect(component.control instanceof UntypedFormControl).toBe(true);
|
|
118
|
-
expect(component.group instanceof UntypedFormGroup).toBe(true);
|
|
119
|
-
expect(component.model instanceof DynamicFormControlModel).toBe(true);
|
|
120
|
-
|
|
121
|
-
expect(component.blur).toBeDefined();
|
|
122
|
-
expect(component.change).toBeDefined();
|
|
123
|
-
expect(component.focus).toBeDefined();
|
|
124
|
-
|
|
125
|
-
expect(component.componentType).toBe(DynamicNGBootstrapInputComponent);
|
|
126
|
-
});
|
|
127
|
-
|
|
128
|
-
it("should have an input element", () => {
|
|
129
|
-
expect(testElement instanceof DebugElement).toBe(true);
|
|
130
|
-
});
|
|
131
|
-
|
|
132
|
-
it("should listen to native blur events", () => {
|
|
133
|
-
spyOn(component, "onBlur");
|
|
134
|
-
|
|
135
|
-
testElement.triggerEventHandler("blur", null);
|
|
136
|
-
|
|
137
|
-
expect(component.onBlur).toHaveBeenCalled();
|
|
138
|
-
});
|
|
139
|
-
|
|
140
|
-
it("should listen to native focus events", () => {
|
|
141
|
-
spyOn(component, "onFocus");
|
|
142
|
-
|
|
143
|
-
testElement.triggerEventHandler("focus", null);
|
|
144
|
-
|
|
145
|
-
expect(component.onFocus).toHaveBeenCalled();
|
|
146
|
-
});
|
|
147
|
-
|
|
148
|
-
it("should listen to native change event", () => {
|
|
149
|
-
spyOn(component, "onChange");
|
|
150
|
-
|
|
151
|
-
testElement.triggerEventHandler("change", null);
|
|
152
|
-
|
|
153
|
-
expect(component.onChange).toHaveBeenCalled();
|
|
154
|
-
});
|
|
155
|
-
|
|
156
|
-
it("should update model value when control value changes", () => {
|
|
157
|
-
spyOn(component, "onControlValueChanges");
|
|
158
|
-
|
|
159
|
-
component.control.setValue("test");
|
|
160
|
-
|
|
161
|
-
expect(component.onControlValueChanges).toHaveBeenCalled();
|
|
162
|
-
});
|
|
163
|
-
|
|
164
|
-
it("should update control value when model value changes", () => {
|
|
165
|
-
spyOn(component, "onModelValueUpdates");
|
|
166
|
-
|
|
167
|
-
inputModel.value = "test";
|
|
168
|
-
|
|
169
|
-
expect(component.onModelValueUpdates).toHaveBeenCalled();
|
|
170
|
-
});
|
|
171
|
-
|
|
172
|
-
it("should update control activation when model disabled property changes", () => {
|
|
173
|
-
spyOn(component, "onModelDisabledUpdates");
|
|
174
|
-
|
|
175
|
-
inputModel.disabled = true;
|
|
176
|
-
|
|
177
|
-
expect(component.onModelDisabledUpdates).toHaveBeenCalled();
|
|
178
|
-
});
|
|
179
|
-
|
|
180
|
-
it("should map a form control model to a form control component", () => {
|
|
181
|
-
expect(ngBootstrapUIFormControlMapFn(formModel[0])).toBe(DynamicNGBootstrapCheckboxComponent);
|
|
182
|
-
expect(ngBootstrapUIFormControlMapFn(formModel[1])).toBe(DynamicNGBootstrapCheckboxGroupComponent);
|
|
183
|
-
expect(ngBootstrapUIFormControlMapFn(formModel[2])).toBeNull();
|
|
184
|
-
expect(ngBootstrapUIFormControlMapFn(formModel[3])).toBe(DynamicNGBootstrapDatePickerComponent);
|
|
185
|
-
expect(ngBootstrapUIFormControlMapFn(formModel[4])).toBeNull();
|
|
186
|
-
expect(ngBootstrapUIFormControlMapFn(formModel[5])).toBeNull();
|
|
187
|
-
expect(ngBootstrapUIFormControlMapFn(formModel[6])).toBe(DynamicNGBootstrapFormArrayComponent);
|
|
188
|
-
expect(ngBootstrapUIFormControlMapFn(formModel[7])).toBe(DynamicNGBootstrapFormGroupComponent);
|
|
189
|
-
expect(ngBootstrapUIFormControlMapFn(formModel[8])).toBe(DynamicNGBootstrapInputComponent);
|
|
190
|
-
expect(ngBootstrapUIFormControlMapFn(formModel[9])).toBe(DynamicNGBootstrapRadioGroupComponent);
|
|
191
|
-
expect(ngBootstrapUIFormControlMapFn(formModel[10])).toBe(DynamicNGBootstrapRatingComponent);
|
|
192
|
-
expect(ngBootstrapUIFormControlMapFn(formModel[11])).toBe(DynamicNGBootstrapSelectComponent);
|
|
193
|
-
expect(ngBootstrapUIFormControlMapFn(formModel[12])).toBeNull();
|
|
194
|
-
expect(ngBootstrapUIFormControlMapFn(formModel[13])).toBe(DynamicNGBootstrapSwitchComponent);
|
|
195
|
-
expect(ngBootstrapUIFormControlMapFn(formModel[14])).toBe(DynamicNGBootstrapTextAreaComponent);
|
|
196
|
-
expect(ngBootstrapUIFormControlMapFn(formModel[15])).toBe(DynamicNGBootstrapTimePickerComponent);
|
|
197
|
-
});
|
|
198
|
-
});
|