primekit 1.0.9 → 1.0.10
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/README.md +25 -25
- package/ng-package.json +8 -0
- package/package.json +12 -25
- package/src/assets/images/empty-table.svg +25 -25
- package/src/lib/lib/atomix-alert/atomix-alert.component.css +67 -0
- package/src/lib/lib/atomix-alert/atomix-alert.component.html +7 -0
- package/src/lib/lib/atomix-alert/atomix-alert.component.spec.ts +154 -0
- package/src/lib/lib/atomix-alert/atomix-alert.component.ts +75 -0
- package/src/lib/lib/atomix-autocomplete/atomix-autocomplete.component.html +35 -0
- package/src/lib/lib/atomix-autocomplete/atomix-autocomplete.component.scss +72 -0
- package/src/lib/lib/atomix-autocomplete/atomix-autocomplete.component.spec.ts +210 -0
- package/src/lib/lib/atomix-autocomplete/atomix-autocomplete.component.ts +70 -0
- package/src/lib/lib/atomix-button/atomix-button.component.css +70 -0
- package/src/lib/lib/atomix-button/atomix-button.component.html +20 -0
- package/src/lib/lib/atomix-button/atomix-button.component.spec.ts +135 -0
- package/src/lib/lib/atomix-button/atomix-button.component.ts +28 -0
- package/{lib/lib/atomix-button/atomix-button.models.d.ts → src/lib/lib/atomix-button/atomix-button.models.ts} +2 -2
- package/src/lib/lib/atomix-calendar/atomix-calendar.component.css +5 -0
- package/src/lib/lib/atomix-calendar/atomix-calendar.component.html +20 -0
- package/src/lib/lib/atomix-calendar/atomix-calendar.component.spec.ts +145 -0
- package/src/lib/lib/atomix-calendar/atomix-calendar.component.ts +71 -0
- package/src/lib/lib/atomix-card/atomix-card.component.css +4 -0
- package/src/lib/lib/atomix-card/atomix-card.component.html +3 -0
- package/src/lib/lib/atomix-card/atomix-card.component.spec.ts +63 -0
- package/src/lib/lib/atomix-card/atomix-card.component.ts +13 -0
- package/src/lib/lib/atomix-confirmation-dialog/atomix-confirmation-dialog.component.css +12 -0
- package/src/lib/lib/atomix-confirmation-dialog/atomix-confirmation-dialog.component.html +9 -0
- package/src/lib/lib/atomix-confirmation-dialog/atomix-confirmation-dialog.component.spec.ts +63 -0
- package/src/lib/lib/atomix-confirmation-dialog/atomix-confirmation-dialog.component.ts +22 -0
- package/src/lib/lib/atomix-daterange-calendar/atomix-daterange-calendar.component.html +233 -0
- package/src/lib/lib/atomix-daterange-calendar/atomix-daterange-calendar.component.scss +266 -0
- package/src/lib/lib/atomix-daterange-calendar/atomix-daterange-calendar.component.spec.ts +1465 -0
- package/src/lib/lib/atomix-daterange-calendar/atomix-daterange-calendar.component.ts +717 -0
- package/src/lib/lib/atomix-divider/atomix-divider.component.css +0 -0
- package/src/lib/lib/atomix-divider/atomix-divider.component.html +7 -0
- package/src/lib/lib/atomix-divider/atomix-divider.component.spec.ts +91 -0
- package/src/lib/lib/atomix-divider/atomix-divider.component.ts +17 -0
- package/src/lib/lib/atomix-dropdown/atomix-dropdown.component.css +25 -0
- package/src/lib/lib/atomix-dropdown/atomix-dropdown.component.html +37 -0
- package/src/lib/lib/atomix-dropdown/atomix-dropdown.component.spec.ts +178 -0
- package/src/lib/lib/atomix-dropdown/atomix-dropdown.component.ts +89 -0
- package/src/lib/lib/atomix-dynamic-dialog/atomix-dynamic-dialog.component.css +0 -0
- package/src/lib/lib/atomix-dynamic-dialog/atomix-dynamic-dialog.component.html +0 -0
- package/src/lib/lib/atomix-dynamic-dialog/atomix-dynamic-dialog.component.spec.ts +128 -0
- package/src/lib/lib/atomix-dynamic-dialog/atomix-dynamic-dialog.component.ts +42 -0
- package/src/lib/lib/atomix-dynamic-dialog/atomix-dynamic-dialog.models.ts +12 -0
- package/src/lib/lib/atomix-form/atomix-form-autocomplete/atomix-form-autocomplete.component.html +20 -0
- package/src/lib/lib/atomix-form/atomix-form-autocomplete/atomix-form-autocomplete.component.scss +7 -0
- package/src/lib/lib/atomix-form/atomix-form-autocomplete/atomix-form-autocomplete.component.spec.ts +169 -0
- package/src/lib/lib/atomix-form/atomix-form-autocomplete/atomix-form-autocomplete.component.ts +41 -0
- package/src/lib/lib/atomix-form/atomix-form-calendar/atomix-form-calendar.component.html +21 -0
- package/src/lib/lib/atomix-form/atomix-form-calendar/atomix-form-calendar.component.scss +7 -0
- package/src/lib/lib/atomix-form/atomix-form-calendar/atomix-form-calendar.component.spec.ts +142 -0
- package/src/lib/lib/atomix-form/atomix-form-calendar/atomix-form-calendar.component.ts +32 -0
- package/src/lib/lib/atomix-form/atomix-form-checkbox/atomix-form-checkbox.component.html +13 -0
- package/src/lib/lib/atomix-form/atomix-form-checkbox/atomix-form-checkbox.component.scss +14 -0
- package/src/lib/lib/atomix-form/atomix-form-checkbox/atomix-form-checkbox.component.spec.ts +112 -0
- package/src/lib/lib/atomix-form/atomix-form-checkbox/atomix-form-checkbox.component.ts +28 -0
- package/src/lib/lib/atomix-form/atomix-form-chips/atomix-form-chips.component.html +20 -0
- package/src/lib/lib/atomix-form/atomix-form-chips/atomix-form-chips.component.scss +3 -0
- package/src/lib/lib/atomix-form/atomix-form-chips/atomix-form-chips.component.spec.ts +153 -0
- package/src/lib/lib/atomix-form/atomix-form-chips/atomix-form-chips.component.ts +28 -0
- package/src/lib/lib/atomix-form/atomix-form-chips/form.chips.models.ts +5 -0
- package/src/lib/lib/atomix-form/atomix-form-dropdown/atomix-form-dropdown.component.html +24 -0
- package/src/lib/lib/atomix-form/atomix-form-dropdown/atomix-form-dropdown.component.scss +15 -0
- package/src/lib/lib/atomix-form/atomix-form-dropdown/atomix-form-dropdown.component.spec.ts +156 -0
- package/src/lib/lib/atomix-form/atomix-form-dropdown/atomix-form-dropdown.component.ts +36 -0
- package/src/lib/lib/atomix-form/atomix-form-input-component/atomix-form-input-component.component.html +33 -0
- package/src/lib/lib/atomix-form/atomix-form-input-component/atomix-form-input-component.component.scss +32 -0
- package/src/lib/lib/atomix-form/atomix-form-input-component/atomix-form-input-component.component.spec.ts +156 -0
- package/src/lib/lib/atomix-form/atomix-form-input-component/atomix-form-input-component.component.ts +42 -0
- package/src/lib/lib/atomix-form/atomix-form-inputmask-component/atomix-form-inputmask-component.component.html +14 -0
- package/src/lib/lib/atomix-form/atomix-form-inputmask-component/atomix-form-inputmask-component.component.scss +0 -0
- package/src/lib/lib/atomix-form/atomix-form-inputmask-component/atomix-form-inputmask-component.component.spec.ts +104 -0
- package/src/lib/lib/atomix-form/atomix-form-inputmask-component/atomix-form-inputmask-component.component.ts +24 -0
- package/src/lib/lib/atomix-form/atomix-form-password-component/atomix-form-password-component.component.html +16 -0
- package/src/lib/lib/atomix-form/atomix-form-password-component/atomix-form-password-component.component.scss +0 -0
- package/src/lib/lib/atomix-form/atomix-form-password-component/atomix-form-password-component.component.spec.ts +92 -0
- package/src/lib/lib/atomix-form/atomix-form-password-component/atomix-form-password-component.component.ts +24 -0
- package/src/lib/lib/atomix-form/atomix-form-radio-button/atomix-radio-button.component.html +23 -0
- package/src/lib/lib/atomix-form/atomix-form-radio-button/atomix-radio-button.component.scss +3 -0
- package/src/lib/lib/atomix-form/atomix-form-radio-button/atomix-radio-button.component.spec.ts +126 -0
- package/src/lib/lib/atomix-form/atomix-form-radio-button/atomix-radio-button.component.ts +26 -0
- package/src/lib/lib/atomix-form/atomix-form-textarea/atomix-form-textarea.component.html +17 -0
- package/src/lib/lib/atomix-form/atomix-form-textarea/atomix-form-textarea.component.scss +6 -0
- package/src/lib/lib/atomix-form/atomix-form-textarea/atomix-form-textarea.component.spec.ts +120 -0
- package/src/lib/lib/atomix-form/atomix-form-textarea/atomix-form-textarea.component.ts +24 -0
- package/src/lib/lib/atomix-input/atomix-input.component.css +52 -0
- package/src/lib/lib/atomix-input/atomix-input.component.html +45 -0
- package/src/lib/lib/atomix-input/atomix-input.component.spec.ts +229 -0
- package/src/lib/lib/atomix-input/atomix-input.component.ts +64 -0
- package/src/lib/lib/atomix-input-switch/atomix-input-switch.component.css +12 -0
- package/src/lib/lib/atomix-input-switch/atomix-input-switch.component.html +17 -0
- package/src/lib/lib/atomix-input-switch/atomix-input-switch.component.spec.ts +173 -0
- package/src/lib/lib/atomix-input-switch/atomix-input-switch.component.ts +62 -0
- package/src/lib/lib/atomix-loading-overlay/atomix-loading-overlay.component.html +47 -0
- package/src/lib/lib/atomix-loading-overlay/atomix-loading-overlay.component.scss +14 -0
- package/src/lib/lib/atomix-loading-overlay/atomix-loading-overlay.component.spec.ts +21 -0
- package/src/lib/lib/atomix-loading-overlay/atomix-loading-overlay.component.ts +25 -0
- package/src/lib/lib/atomix-messages/messages.component.css +0 -0
- package/src/lib/lib/atomix-messages/messages.component.html +9 -0
- package/src/lib/lib/atomix-messages/messages.component.spec.ts +115 -0
- package/src/lib/lib/atomix-messages/messages.component.ts +17 -0
- package/src/lib/lib/atomix-pagination/atomix-pagination.component.css +19 -0
- package/src/lib/lib/atomix-pagination/atomix-pagination.component.html +24 -0
- package/src/lib/lib/atomix-pagination/atomix-pagination.component.spec.ts +98 -0
- package/src/lib/lib/atomix-pagination/atomix-pagination.component.ts +36 -0
- package/src/lib/lib/atomix-radio-button/atomix-radio-button.component.css +0 -0
- package/src/lib/lib/atomix-radio-button/atomix-radio-button.component.html +7 -0
- package/src/lib/lib/atomix-radio-button/atomix-radio-button.component.spec.ts +116 -0
- package/src/lib/lib/atomix-radio-button/atomix-radio-button.component.ts +37 -0
- package/src/lib/lib/atomix-search-dropdown/atomix-search-dropdown.component.css +49 -0
- package/src/lib/lib/atomix-search-dropdown/atomix-search-dropdown.component.html +68 -0
- package/src/lib/lib/atomix-search-dropdown/atomix-search-dropdown.component.spec.ts +282 -0
- package/src/lib/lib/atomix-search-dropdown/atomix-search-dropdown.component.ts +119 -0
- package/{lib/lib/atomix-select-button/atomix-select-button-models.d.ts → src/lib/lib/atomix-select-button/atomix-select-button-models.ts} +4 -4
- package/src/lib/lib/atomix-select-button/atomix-select-button.component.css +5 -0
- package/src/lib/lib/atomix-select-button/atomix-select-button.component.html +7 -0
- package/src/lib/lib/atomix-select-button/atomix-select-button.component.spec.ts +73 -0
- package/src/lib/lib/atomix-select-button/atomix-select-button.component.ts +19 -0
- package/src/lib/lib/atomix-snackbar/atomix-snackbar.component.css +30 -0
- package/src/lib/lib/atomix-snackbar/atomix-snackbar.component.html +4 -0
- package/src/lib/lib/atomix-snackbar/atomix-snackbar.component.spec.ts +60 -0
- package/src/lib/lib/atomix-snackbar/atomix-snackbar.component.ts +27 -0
- package/src/lib/lib/atomix-spinner/atomix-spinner.component.css +0 -0
- package/src/lib/lib/atomix-spinner/atomix-spinner.component.html +7 -0
- package/src/lib/lib/atomix-spinner/atomix-spinner.component.spec.ts +70 -0
- package/src/lib/lib/atomix-spinner/atomix-spinner.component.ts +13 -0
- package/src/lib/lib/atomix-steps/atomix-steps.component.html +9 -0
- package/src/lib/lib/atomix-steps/atomix-steps.component.scss +0 -0
- package/src/lib/lib/atomix-steps/atomix-steps.component.spec.ts +120 -0
- package/src/lib/lib/atomix-steps/atomix-steps.component.ts +32 -0
- package/src/lib/lib/atomix-tabMenu/atomix-tabMenu.component.css +0 -0
- package/src/lib/lib/atomix-tabMenu/atomix-tabMenu.component.html +26 -0
- package/src/lib/lib/atomix-tabMenu/atomix-tabMenu.component.spec.ts +106 -0
- package/src/lib/lib/atomix-tabMenu/atomix-tabMenu.component.ts +36 -0
- package/src/lib/lib/atomix-table/atomix-table.component.css +152 -0
- package/src/lib/lib/atomix-table/atomix-table.component.html +647 -0
- package/src/lib/lib/atomix-table/atomix-table.component.spec.ts +1648 -0
- package/src/lib/lib/atomix-table/atomix-table.component.ts +422 -0
- package/src/lib/lib/atomix-table/atomix-table.models.ts +39 -0
- package/src/lib/lib/atomix-tag/atomix-tag.component.css +0 -0
- package/src/lib/lib/atomix-tag/atomix-tag.component.html +6 -0
- package/src/lib/lib/atomix-tag/atomix-tag.component.spec.ts +47 -0
- package/src/lib/lib/atomix-tag/atomix-tag.component.ts +13 -0
- package/src/lib/lib/utils/prime-icons.util.spec.ts +21 -0
- package/src/lib/lib/utils/prime-icons.util.ts +11 -0
- package/src/lib/primekit.component.spec.ts +19 -0
- package/src/lib/primekit.component.ts +10 -0
- package/src/lib/primekit.module.spec.ts +155 -0
- package/src/lib/primekit.module.ts +183 -0
- package/src/lib/primekit.service.spec.ts +17 -0
- package/src/lib/primekit.service.ts +8 -0
- package/{public-api.d.ts → src/public-api.ts} +47 -37
- package/tsconfig.lib.json +13 -0
- package/tsconfig.lib.prod.json +11 -0
- package/tsconfig.spec.json +10 -0
- package/esm2022/lib/lib/atomix-alert/atomix-alert.component.mjs +0 -76
- package/esm2022/lib/lib/atomix-autocomplete/atomix-autocomplete.component.mjs +0 -108
- package/esm2022/lib/lib/atomix-button/atomix-button.component.mjs +0 -49
- package/esm2022/lib/lib/atomix-button/atomix-button.models.mjs +0 -2
- package/esm2022/lib/lib/atomix-calendar/atomix-calendar.component.mjs +0 -90
- package/esm2022/lib/lib/atomix-card/atomix-card.component.mjs +0 -24
- package/esm2022/lib/lib/atomix-confirmation-dialog/atomix-confirmation-dialog.component.mjs +0 -28
- package/esm2022/lib/lib/atomix-daterange-calendar/atomix-daterange-calendar.component.mjs +0 -648
- package/esm2022/lib/lib/atomix-divider/atomix-divider.component.mjs +0 -27
- package/esm2022/lib/lib/atomix-dropdown/atomix-dropdown.component.mjs +0 -105
- package/esm2022/lib/lib/atomix-dynamic-dialog/atomix-dynamic-dialog.component.mjs +0 -38
- package/esm2022/lib/lib/atomix-dynamic-dialog/atomix-dynamic-dialog.models.mjs +0 -2
- package/esm2022/lib/lib/atomix-form/atomix-form-autocomplete/atomix-form-autocomplete.component.mjs +0 -67
- package/esm2022/lib/lib/atomix-form/atomix-form-calendar/atomix-form-calendar.component.mjs +0 -59
- package/esm2022/lib/lib/atomix-form/atomix-form-checkbox/atomix-form-checkbox.component.mjs +0 -48
- package/esm2022/lib/lib/atomix-form/atomix-form-chips/atomix-form-chips.component.mjs +0 -54
- package/esm2022/lib/lib/atomix-form/atomix-form-chips/form.chips.models.mjs +0 -2
- package/esm2022/lib/lib/atomix-form/atomix-form-dropdown/atomix-form-dropdown.component.mjs +0 -70
- package/esm2022/lib/lib/atomix-form/atomix-form-input-component/atomix-form-input-component.component.mjs +0 -80
- package/esm2022/lib/lib/atomix-form/atomix-form-inputmask-component/atomix-form-inputmask-component.component.mjs +0 -48
- package/esm2022/lib/lib/atomix-form/atomix-form-password-component/atomix-form-password-component.component.mjs +0 -48
- package/esm2022/lib/lib/atomix-form/atomix-form-radio-button/atomix-radio-button.component.mjs +0 -46
- package/esm2022/lib/lib/atomix-form/atomix-form-textarea/atomix-form-textarea.component.mjs +0 -46
- package/esm2022/lib/lib/atomix-input/atomix-input.component.mjs +0 -94
- package/esm2022/lib/lib/atomix-input-switch/atomix-input-switch.component.mjs +0 -85
- package/esm2022/lib/lib/atomix-messages/messages.component.mjs +0 -33
- package/esm2022/lib/lib/atomix-pagination/atomix-pagination.component.mjs +0 -48
- package/esm2022/lib/lib/atomix-radio-button/atomix-radio-button.component.mjs +0 -50
- package/esm2022/lib/lib/atomix-search-dropdown/atomix-search-dropdown.component.mjs +0 -149
- package/esm2022/lib/lib/atomix-select-button/atomix-select-button-models.mjs +0 -2
- package/esm2022/lib/lib/atomix-select-button/atomix-select-button.component.mjs +0 -25
- package/esm2022/lib/lib/atomix-snackbar/atomix-snackbar.component.mjs +0 -29
- package/esm2022/lib/lib/atomix-spinner/atomix-spinner.component.mjs +0 -24
- package/esm2022/lib/lib/atomix-steps/atomix-steps.component.mjs +0 -41
- package/esm2022/lib/lib/atomix-tabMenu/atomix-tabMenu.component.mjs +0 -51
- package/esm2022/lib/lib/atomix-table/atomix-table.component.mjs +0 -454
- package/esm2022/lib/lib/atomix-table/atomix-table.models.mjs +0 -2
- package/esm2022/lib/lib/atomix-tag/atomix-tag.component.mjs +0 -24
- package/esm2022/lib/lib/utils/prime-icons.util.mjs +0 -10
- package/esm2022/lib/primekit.component.mjs +0 -11
- package/esm2022/lib/primekit.module.mjs +0 -313
- package/esm2022/lib/primekit.service.mjs +0 -14
- package/esm2022/primekit.mjs +0 -5
- package/esm2022/public-api.mjs +0 -43
- package/fesm2022/primekit.mjs +0 -3041
- package/fesm2022/primekit.mjs.map +0 -1
- package/index.d.ts +0 -5
- package/lib/lib/atomix-alert/atomix-alert.component.d.ts +0 -22
- package/lib/lib/atomix-autocomplete/atomix-autocomplete.component.d.ts +0 -34
- package/lib/lib/atomix-button/atomix-button.component.d.ts +0 -19
- package/lib/lib/atomix-calendar/atomix-calendar.component.d.ts +0 -27
- package/lib/lib/atomix-card/atomix-card.component.d.ts +0 -9
- package/lib/lib/atomix-confirmation-dialog/atomix-confirmation-dialog.component.d.ts +0 -12
- package/lib/lib/atomix-daterange-calendar/atomix-daterange-calendar.component.d.ts +0 -72
- package/lib/lib/atomix-divider/atomix-divider.component.d.ts +0 -12
- package/lib/lib/atomix-dropdown/atomix-dropdown.component.d.ts +0 -50
- package/lib/lib/atomix-dynamic-dialog/atomix-dynamic-dialog.component.d.ts +0 -15
- package/lib/lib/atomix-dynamic-dialog/atomix-dynamic-dialog.models.d.ts +0 -11
- package/lib/lib/atomix-form/atomix-form-autocomplete/atomix-form-autocomplete.component.d.ts +0 -25
- package/lib/lib/atomix-form/atomix-form-calendar/atomix-form-calendar.component.d.ts +0 -23
- package/lib/lib/atomix-form/atomix-form-checkbox/atomix-form-checkbox.component.d.ts +0 -18
- package/lib/lib/atomix-form/atomix-form-chips/atomix-form-chips.component.d.ts +0 -19
- package/lib/lib/atomix-form/atomix-form-chips/form.chips.models.d.ts +0 -5
- package/lib/lib/atomix-form/atomix-form-dropdown/atomix-form-dropdown.component.d.ts +0 -25
- package/lib/lib/atomix-form/atomix-form-input-component/atomix-form-input-component.component.d.ts +0 -28
- package/lib/lib/atomix-form/atomix-form-inputmask-component/atomix-form-inputmask-component.component.d.ts +0 -17
- package/lib/lib/atomix-form/atomix-form-password-component/atomix-form-password-component.component.d.ts +0 -17
- package/lib/lib/atomix-form/atomix-form-radio-button/atomix-radio-button.component.d.ts +0 -19
- package/lib/lib/atomix-form/atomix-form-textarea/atomix-form-textarea.component.d.ts +0 -17
- package/lib/lib/atomix-input/atomix-input.component.d.ts +0 -29
- package/lib/lib/atomix-input-switch/atomix-input-switch.component.d.ts +0 -30
- package/lib/lib/atomix-messages/messages.component.d.ts +0 -13
- package/lib/lib/atomix-pagination/atomix-pagination.component.d.ts +0 -19
- package/lib/lib/atomix-radio-button/atomix-radio-button.component.d.ts +0 -15
- package/lib/lib/atomix-search-dropdown/atomix-search-dropdown.component.d.ts +0 -60
- package/lib/lib/atomix-select-button/atomix-select-button.component.d.ts +0 -12
- package/lib/lib/atomix-snackbar/atomix-snackbar.component.d.ts +0 -12
- package/lib/lib/atomix-spinner/atomix-spinner.component.d.ts +0 -9
- package/lib/lib/atomix-steps/atomix-steps.component.d.ts +0 -19
- package/lib/lib/atomix-tabMenu/atomix-tabMenu.component.d.ts +0 -19
- package/lib/lib/atomix-table/atomix-table.component.d.ts +0 -119
- package/lib/lib/atomix-table/atomix-table.models.d.ts +0 -43
- package/lib/lib/atomix-tag/atomix-tag.component.d.ts +0 -9
- package/lib/lib/utils/prime-icons.util.d.ts +0 -3
- package/lib/primekit.component.d.ts +0 -5
- package/lib/primekit.module.d.ts +0 -70
- package/lib/primekit.service.d.ts +0 -6
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
import { NO_ERRORS_SCHEMA } from '@angular/core';
|
|
2
|
+
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
3
|
+
import { FormControl, FormGroup, ReactiveFormsModule } from '@angular/forms';
|
|
4
|
+
import { AtomixFormChipsComponent } from './atomix-form-chips.component';
|
|
5
|
+
|
|
6
|
+
describe('AtomixFormChipsComponent', () => {
|
|
7
|
+
let component: AtomixFormChipsComponent;
|
|
8
|
+
let fixture: ComponentFixture<AtomixFormChipsComponent>;
|
|
9
|
+
|
|
10
|
+
beforeEach(() => {
|
|
11
|
+
TestBed.configureTestingModule({
|
|
12
|
+
declarations: [AtomixFormChipsComponent],
|
|
13
|
+
imports: [ReactiveFormsModule],
|
|
14
|
+
schemas: [NO_ERRORS_SCHEMA],
|
|
15
|
+
});
|
|
16
|
+
fixture = TestBed.createComponent(AtomixFormChipsComponent);
|
|
17
|
+
component = fixture.componentInstance;
|
|
18
|
+
component.form = new FormGroup({ testField: new FormControl([]) });
|
|
19
|
+
component.controlName = 'testField';
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
it('should create', () => {
|
|
23
|
+
expect(component).toBeTruthy();
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
describe('FormGroup binding', () => {
|
|
27
|
+
it('should return the correct FormControl from the form via control accessor', () => {
|
|
28
|
+
const control = component.control;
|
|
29
|
+
expect(control).toBe(component.form.get('testField'));
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
it('should return a FormControl instance', () => {
|
|
33
|
+
expect(component.control).toBeInstanceOf(FormControl);
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
it('should reflect the form control value', () => {
|
|
37
|
+
component.form.get('testField')!.setValue(['chip1', 'chip2']);
|
|
38
|
+
expect(component.control.value).toEqual(['chip1', 'chip2']);
|
|
39
|
+
});
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
describe('chip add/remove updating form control', () => {
|
|
43
|
+
it('should update form control value when a chip is added', () => {
|
|
44
|
+
component.control.setValue(['chip1']);
|
|
45
|
+
expect(component.form.get('testField')!.value).toEqual(['chip1']);
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
it('should update form control value when multiple chips are added', () => {
|
|
49
|
+
component.control.setValue(['chip1', 'chip2', 'chip3']);
|
|
50
|
+
expect(component.form.get('testField')!.value).toEqual(['chip1', 'chip2', 'chip3']);
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
it('should update form control value when a chip is removed', () => {
|
|
54
|
+
component.control.setValue(['chip1', 'chip2', 'chip3']);
|
|
55
|
+
component.control.setValue(['chip1', 'chip3']);
|
|
56
|
+
expect(component.form.get('testField')!.value).toEqual(['chip1', 'chip3']);
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
it('should update form control to empty array when all chips are removed', () => {
|
|
60
|
+
component.control.setValue(['chip1', 'chip2']);
|
|
61
|
+
component.control.setValue([]);
|
|
62
|
+
expect(component.form.get('testField')!.value).toEqual([]);
|
|
63
|
+
});
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
describe('input properties', () => {
|
|
67
|
+
it('should have default label as empty string', () => {
|
|
68
|
+
expect(component.label).toBe('');
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
it('should accept label input', () => {
|
|
72
|
+
component.label = 'Tags';
|
|
73
|
+
expect(component.label).toBe('Tags');
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
it('should have default placeholder as empty string', () => {
|
|
77
|
+
expect(component.placeholder).toBe('');
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
it('should accept placeholder input', () => {
|
|
81
|
+
component.placeholder = 'Add a tag';
|
|
82
|
+
expect(component.placeholder).toBe('Add a tag');
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
it('should accept tooltip input', () => {
|
|
86
|
+
component.tooltip = 'Enter tags separated by comma';
|
|
87
|
+
expect(component.tooltip).toBe('Enter tags separated by comma');
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
it('should have default tooltipPosition as bottom', () => {
|
|
91
|
+
expect(component.tooltipPosition).toBe('bottom');
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
it('should accept tooltipPosition input', () => {
|
|
95
|
+
component.tooltipPosition = 'top';
|
|
96
|
+
expect(component.tooltipPosition).toBe('top');
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
it('should have default type as text', () => {
|
|
100
|
+
expect(component.type).toBe('text');
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
it('should accept type input', () => {
|
|
104
|
+
component.type = 'email';
|
|
105
|
+
expect(component.type).toBe('email');
|
|
106
|
+
});
|
|
107
|
+
|
|
108
|
+
it('should have default styleClass as empty string', () => {
|
|
109
|
+
expect(component.styleClass).toBe('');
|
|
110
|
+
});
|
|
111
|
+
|
|
112
|
+
it('should accept styleClass input', () => {
|
|
113
|
+
component.styleClass = 'custom-class';
|
|
114
|
+
expect(component.styleClass).toBe('custom-class');
|
|
115
|
+
});
|
|
116
|
+
|
|
117
|
+
it('should have default allowDuplicate as false', () => {
|
|
118
|
+
expect(component.allowDuplicate).toBe(false);
|
|
119
|
+
});
|
|
120
|
+
|
|
121
|
+
it('should accept allowDuplicate input', () => {
|
|
122
|
+
component.allowDuplicate = true;
|
|
123
|
+
expect(component.allowDuplicate).toBe(true);
|
|
124
|
+
});
|
|
125
|
+
|
|
126
|
+
it('should have default isLabelIconRequired as false', () => {
|
|
127
|
+
expect(component.isLabelIconRequired).toBe(false);
|
|
128
|
+
});
|
|
129
|
+
|
|
130
|
+
it('should accept isLabelIconRequired input', () => {
|
|
131
|
+
component.isLabelIconRequired = true;
|
|
132
|
+
expect(component.isLabelIconRequired).toBe(true);
|
|
133
|
+
});
|
|
134
|
+
|
|
135
|
+
it('should have default isLabelIconData with empty values', () => {
|
|
136
|
+
expect(component.isLabelIconData).toEqual({
|
|
137
|
+
iconClass: '',
|
|
138
|
+
tooltip: '',
|
|
139
|
+
});
|
|
140
|
+
});
|
|
141
|
+
|
|
142
|
+
it('should accept isLabelIconData input', () => {
|
|
143
|
+
component.isLabelIconData = {
|
|
144
|
+
iconClass: 'pi pi-info-circle',
|
|
145
|
+
tooltip: 'Help text',
|
|
146
|
+
};
|
|
147
|
+
expect(component.isLabelIconData).toEqual({
|
|
148
|
+
iconClass: 'pi pi-info-circle',
|
|
149
|
+
tooltip: 'Help text',
|
|
150
|
+
});
|
|
151
|
+
});
|
|
152
|
+
});
|
|
153
|
+
});
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { Component, Input } from '@angular/core';
|
|
2
|
+
import { FormControl, FormGroup } from '@angular/forms';
|
|
3
|
+
import { LabelIconData } from './form.chips.models';
|
|
4
|
+
|
|
5
|
+
@Component({
|
|
6
|
+
selector: 'atomix-form-chips',
|
|
7
|
+
templateUrl: './atomix-form-chips.component.html',
|
|
8
|
+
styleUrls: ['./atomix-form-chips.component.scss'],
|
|
9
|
+
})
|
|
10
|
+
export class AtomixFormChipsComponent {
|
|
11
|
+
@Input() controlName!: string;
|
|
12
|
+
@Input() form!: FormGroup;
|
|
13
|
+
@Input() label = '';
|
|
14
|
+
@Input() placeholder = '';
|
|
15
|
+
@Input() tooltip!: string;
|
|
16
|
+
@Input() tooltipPosition: 'right' | 'left' | 'top' | 'bottom' = 'bottom';
|
|
17
|
+
@Input() type = 'text';
|
|
18
|
+
@Input() styleClass = '';
|
|
19
|
+
@Input() allowDuplicate: boolean = false;
|
|
20
|
+
@Input() isLabelIconData: LabelIconData = {
|
|
21
|
+
iconClass: '',
|
|
22
|
+
tooltip: '',
|
|
23
|
+
};
|
|
24
|
+
@Input() isLabelIconRequired: boolean = false;
|
|
25
|
+
get control() {
|
|
26
|
+
return this.form.get(this.controlName) as FormControl;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
<label *ngIf="label" [for]="controlName"
|
|
2
|
+
>{{ label }}
|
|
3
|
+
<span *ngIf="isLabelRequired" class="lib-error-asterisk">*</span>
|
|
4
|
+
<i
|
|
5
|
+
*ngIf="isLabelIconData.required"
|
|
6
|
+
[class]="isLabelIconData?.iconClass"
|
|
7
|
+
[pTooltip]="isLabelIconData?.tooltip"
|
|
8
|
+
></i
|
|
9
|
+
></label>
|
|
10
|
+
<p-dropdown
|
|
11
|
+
[filter]="filterResults"
|
|
12
|
+
[formControl]="control"
|
|
13
|
+
[placeholder]="placeholder"
|
|
14
|
+
[options]="options"
|
|
15
|
+
[optionLabel]="optionLabel"
|
|
16
|
+
[optionValue]="optionValue"
|
|
17
|
+
[showClear]="showClear"
|
|
18
|
+
[pTooltip]="tooltip"
|
|
19
|
+
[tooltipPosition]="tooltipPosition"
|
|
20
|
+
(onChange)="selectionChange.emit($event)"
|
|
21
|
+
[styleClass]="styleClass + ' form-dropdown'"
|
|
22
|
+
appendTo="body"
|
|
23
|
+
>
|
|
24
|
+
</p-dropdown>
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
import { NO_ERRORS_SCHEMA } from '@angular/core';
|
|
2
|
+
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
3
|
+
import { FormControl, FormGroup, ReactiveFormsModule } from '@angular/forms';
|
|
4
|
+
import { AtomixFormDropdownComponent } from './atomix-form-dropdown.component';
|
|
5
|
+
|
|
6
|
+
describe('AtomixFormDropdownComponent', () => {
|
|
7
|
+
let component: AtomixFormDropdownComponent;
|
|
8
|
+
let fixture: ComponentFixture<AtomixFormDropdownComponent>;
|
|
9
|
+
|
|
10
|
+
beforeEach(() => {
|
|
11
|
+
TestBed.configureTestingModule({
|
|
12
|
+
declarations: [AtomixFormDropdownComponent],
|
|
13
|
+
imports: [ReactiveFormsModule],
|
|
14
|
+
schemas: [NO_ERRORS_SCHEMA],
|
|
15
|
+
});
|
|
16
|
+
fixture = TestBed.createComponent(AtomixFormDropdownComponent);
|
|
17
|
+
component = fixture.componentInstance;
|
|
18
|
+
component.form = new FormGroup({ testField: new FormControl('') });
|
|
19
|
+
component.controlName = 'testField';
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
it('should create', () => {
|
|
23
|
+
expect(component).toBeTruthy();
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
describe('FormGroup binding', () => {
|
|
27
|
+
it('should return the correct FormControl from the form via control accessor', () => {
|
|
28
|
+
const control = component.control;
|
|
29
|
+
expect(control).toBe(component.form.get('testField'));
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
it('should return a FormControl instance', () => {
|
|
33
|
+
expect(component.control).toBeInstanceOf(FormControl);
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
it('should reflect the form control value', () => {
|
|
37
|
+
component.form.get('testField')!.setValue('optionA');
|
|
38
|
+
expect(component.control.value).toBe('optionA');
|
|
39
|
+
});
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
describe('options input', () => {
|
|
43
|
+
it('should accept options input', () => {
|
|
44
|
+
const options = [
|
|
45
|
+
{ label: 'Option A', value: 'a' },
|
|
46
|
+
{ label: 'Option B', value: 'b' },
|
|
47
|
+
];
|
|
48
|
+
component.options = options;
|
|
49
|
+
expect(component.options).toEqual(options);
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
it('should accept optionLabel input', () => {
|
|
53
|
+
component.optionLabel = 'name';
|
|
54
|
+
expect(component.optionLabel).toBe('name');
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
it('should accept optionValue input', () => {
|
|
58
|
+
component.optionValue = 'id';
|
|
59
|
+
expect(component.optionValue).toBe('id');
|
|
60
|
+
});
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
describe('selection updating form control', () => {
|
|
64
|
+
it('should emit selectionChange when selection occurs', () => {
|
|
65
|
+
const emitSpy = jest.fn();
|
|
66
|
+
component.selectionChange.subscribe(emitSpy);
|
|
67
|
+
|
|
68
|
+
const mockEvent = { value: 'selectedValue' };
|
|
69
|
+
component.selectionChange.emit(mockEvent);
|
|
70
|
+
|
|
71
|
+
expect(emitSpy).toHaveBeenCalledWith(mockEvent);
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
it('should update form control value when set programmatically', () => {
|
|
75
|
+
component.control.setValue('newSelection');
|
|
76
|
+
expect(component.form.get('testField')!.value).toBe('newSelection');
|
|
77
|
+
});
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
describe('input properties', () => {
|
|
81
|
+
it('should have default label as empty string', () => {
|
|
82
|
+
expect(component.label).toBe('');
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
it('should accept label input', () => {
|
|
86
|
+
component.label = 'Select Country';
|
|
87
|
+
expect(component.label).toBe('Select Country');
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
it('should have default placeholder as empty string', () => {
|
|
91
|
+
expect(component.placeholder).toBe('');
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
it('should accept placeholder input', () => {
|
|
95
|
+
component.placeholder = 'Choose an option';
|
|
96
|
+
expect(component.placeholder).toBe('Choose an option');
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
it('should have default filterResults as false', () => {
|
|
100
|
+
expect(component.filterResults).toBe(false);
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
it('should accept filterResults input', () => {
|
|
104
|
+
component.filterResults = true;
|
|
105
|
+
expect(component.filterResults).toBe(true);
|
|
106
|
+
});
|
|
107
|
+
|
|
108
|
+
it('should have default showClear as true', () => {
|
|
109
|
+
expect(component.showClear).toBe(true);
|
|
110
|
+
});
|
|
111
|
+
|
|
112
|
+
it('should accept showClear input', () => {
|
|
113
|
+
component.showClear = false;
|
|
114
|
+
expect(component.showClear).toBe(false);
|
|
115
|
+
});
|
|
116
|
+
|
|
117
|
+
it('should have default tooltipPosition as bottom', () => {
|
|
118
|
+
expect(component.tooltipPosition).toBe('bottom');
|
|
119
|
+
});
|
|
120
|
+
|
|
121
|
+
it('should accept tooltipPosition input', () => {
|
|
122
|
+
component.tooltipPosition = 'top';
|
|
123
|
+
expect(component.tooltipPosition).toBe('top');
|
|
124
|
+
});
|
|
125
|
+
|
|
126
|
+
it('should have default isLabelRequired as false', () => {
|
|
127
|
+
expect(component.isLabelRequired).toBe(false);
|
|
128
|
+
});
|
|
129
|
+
|
|
130
|
+
it('should accept isLabelRequired input', () => {
|
|
131
|
+
component.isLabelRequired = true;
|
|
132
|
+
expect(component.isLabelRequired).toBe(true);
|
|
133
|
+
});
|
|
134
|
+
|
|
135
|
+
it('should accept styleClass input', () => {
|
|
136
|
+
component.styleClass = 'custom-class';
|
|
137
|
+
expect(component.styleClass).toBe('custom-class');
|
|
138
|
+
});
|
|
139
|
+
|
|
140
|
+
it('should accept tooltip input', () => {
|
|
141
|
+
component.tooltip = 'Help text';
|
|
142
|
+
expect(component.tooltip).toBe('Help text');
|
|
143
|
+
});
|
|
144
|
+
});
|
|
145
|
+
|
|
146
|
+
describe('filterEvent output', () => {
|
|
147
|
+
it('should emit filterEvent when triggered', () => {
|
|
148
|
+
const emitSpy = jest.fn();
|
|
149
|
+
component.filterEvent.subscribe(emitSpy);
|
|
150
|
+
|
|
151
|
+
component.filterEvent.emit('search term');
|
|
152
|
+
|
|
153
|
+
expect(emitSpy).toHaveBeenCalledWith('search term');
|
|
154
|
+
});
|
|
155
|
+
});
|
|
156
|
+
});
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { Component, EventEmitter, Input, Output } from '@angular/core';
|
|
2
|
+
import { FormControl, FormGroup } from '@angular/forms';
|
|
3
|
+
import { LabelIconData } from '../atomix-form-chips/form.chips.models';
|
|
4
|
+
|
|
5
|
+
@Component({
|
|
6
|
+
selector: 'atomix-form-dropdown',
|
|
7
|
+
templateUrl: './atomix-form-dropdown.component.html',
|
|
8
|
+
styleUrls: ['./atomix-form-dropdown.component.scss'],
|
|
9
|
+
})
|
|
10
|
+
export class AtomixFormDropdownComponent {
|
|
11
|
+
@Input() controlName!: string;
|
|
12
|
+
@Input() filterResults = false;
|
|
13
|
+
@Input() form!: FormGroup;
|
|
14
|
+
@Input() label = '';
|
|
15
|
+
@Input() optionLabel = '';
|
|
16
|
+
@Input() optionValue = '';
|
|
17
|
+
@Input() options!: any;
|
|
18
|
+
@Input() placeholder = '';
|
|
19
|
+
@Input() showClear = true;
|
|
20
|
+
@Input() tooltip!: string;
|
|
21
|
+
@Input() tooltipPosition: 'right' | 'left' | 'top' | 'bottom' = 'bottom';
|
|
22
|
+
@Input() isLabelRequired: boolean = false;
|
|
23
|
+
@Input() styleClass!: string;
|
|
24
|
+
@Input() isLabelIconData: LabelIconData = {
|
|
25
|
+
iconClass: '',
|
|
26
|
+
tooltip: '',
|
|
27
|
+
required: false,
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
@Output() selectionChange = new EventEmitter();
|
|
31
|
+
@Output() filterEvent = new EventEmitter<string>();
|
|
32
|
+
|
|
33
|
+
get control() {
|
|
34
|
+
return this.form.get(this.controlName) as FormControl;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
<label *ngIf="label" [for]="controlName"
|
|
2
|
+
>{{ label }} <span *ngIf="isLabelRequired" class="error-asterisk">*</span
|
|
3
|
+
><i
|
|
4
|
+
*ngIf="isLabelIconRequired"
|
|
5
|
+
[class]="isLabelIconData?.iconClass + ' ml-2'"
|
|
6
|
+
[pTooltip]="isLabelIconData?.tooltip"
|
|
7
|
+
></i
|
|
8
|
+
></label>
|
|
9
|
+
<div class="input-wrapper">
|
|
10
|
+
<input
|
|
11
|
+
pInputText
|
|
12
|
+
[id]="controlName"
|
|
13
|
+
[formControl]="control"
|
|
14
|
+
[placeholder]="placeholder"
|
|
15
|
+
[maxlength]="max"
|
|
16
|
+
[min]="min"
|
|
17
|
+
(input)="onInput($event)"
|
|
18
|
+
[pTooltip]="tooltip"
|
|
19
|
+
[type]="type"
|
|
20
|
+
[tooltipPosition]="tooltipPosition"
|
|
21
|
+
[ngClass]="class + ' lib-input-field' + (buttonText ? ' with-button' : '')"
|
|
22
|
+
autocomplete="new-password"
|
|
23
|
+
[style]="style"
|
|
24
|
+
/>
|
|
25
|
+
<button
|
|
26
|
+
*ngIf="buttonText"
|
|
27
|
+
(click)="buttonClick.emit()"
|
|
28
|
+
class="inline-button"
|
|
29
|
+
[type]="buttonType"
|
|
30
|
+
>
|
|
31
|
+
{{ buttonText }}
|
|
32
|
+
</button>
|
|
33
|
+
</div>
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
::ng-deep .lib-input-field {
|
|
2
|
+
border-radius: var(--global-border-radius);
|
|
3
|
+
margin-top: 0.2rem;
|
|
4
|
+
}
|
|
5
|
+
::ng-deep .lib-input-field.with-button {
|
|
6
|
+
padding-right: 6rem;
|
|
7
|
+
}
|
|
8
|
+
.error-asterisk {
|
|
9
|
+
color: red;
|
|
10
|
+
}
|
|
11
|
+
.input-wrapper {
|
|
12
|
+
position: relative;
|
|
13
|
+
}
|
|
14
|
+
.inline-button {
|
|
15
|
+
position: absolute;
|
|
16
|
+
right: 5px;
|
|
17
|
+
background-color: transparent;
|
|
18
|
+
color: #63b77e;
|
|
19
|
+
font-weight: 700;
|
|
20
|
+
border: none;
|
|
21
|
+
cursor: pointer;
|
|
22
|
+
font-size: 0.875rem;
|
|
23
|
+
height: 95%;
|
|
24
|
+
margin-top: 0.2rem;
|
|
25
|
+
border-left: 1px solid grey;
|
|
26
|
+
&:focus {
|
|
27
|
+
outline: none;
|
|
28
|
+
}
|
|
29
|
+
&:hover {
|
|
30
|
+
background-color: transparent;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
import { NO_ERRORS_SCHEMA } from '@angular/core';
|
|
2
|
+
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
3
|
+
import { FormControl, FormGroup, ReactiveFormsModule } from '@angular/forms';
|
|
4
|
+
import { AtomixFormInputComponent } from './atomix-form-input-component.component';
|
|
5
|
+
|
|
6
|
+
describe('AtomixFormInputComponent', () => {
|
|
7
|
+
let component: AtomixFormInputComponent;
|
|
8
|
+
let fixture: ComponentFixture<AtomixFormInputComponent>;
|
|
9
|
+
|
|
10
|
+
beforeEach(() => {
|
|
11
|
+
TestBed.configureTestingModule({
|
|
12
|
+
declarations: [AtomixFormInputComponent],
|
|
13
|
+
imports: [ReactiveFormsModule],
|
|
14
|
+
schemas: [NO_ERRORS_SCHEMA],
|
|
15
|
+
});
|
|
16
|
+
fixture = TestBed.createComponent(AtomixFormInputComponent);
|
|
17
|
+
component = fixture.componentInstance;
|
|
18
|
+
component.form = new FormGroup({ testField: new FormControl('') });
|
|
19
|
+
component.controlName = 'testField';
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
it('should create', () => {
|
|
23
|
+
expect(component).toBeTruthy();
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
describe('FormGroup binding', () => {
|
|
27
|
+
it('should return the correct FormControl from the form via control accessor', () => {
|
|
28
|
+
const control = component.control;
|
|
29
|
+
expect(control).toBe(component.form.get('testField'));
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
it('should return a FormControl instance', () => {
|
|
33
|
+
expect(component.control).toBeInstanceOf(FormControl);
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
it('should reflect the form control value', () => {
|
|
37
|
+
component.form.get('testField')!.setValue('hello');
|
|
38
|
+
expect(component.control.value).toBe('hello');
|
|
39
|
+
});
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
describe('input properties', () => {
|
|
43
|
+
it('should have default label as empty string', () => {
|
|
44
|
+
expect(component.label).toBe('');
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
it('should accept label input', () => {
|
|
48
|
+
component.label = 'Username';
|
|
49
|
+
fixture.detectChanges();
|
|
50
|
+
expect(component.label).toBe('Username');
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
it('should have default placeholder as empty string', () => {
|
|
54
|
+
expect(component.placeholder).toBe('');
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
it('should accept placeholder input', () => {
|
|
58
|
+
component.placeholder = 'Enter value';
|
|
59
|
+
fixture.detectChanges();
|
|
60
|
+
expect(component.placeholder).toBe('Enter value');
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
it('should have default type as text', () => {
|
|
64
|
+
expect(component.type).toBe('text');
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
it('should accept type input', () => {
|
|
68
|
+
component.type = 'number';
|
|
69
|
+
fixture.detectChanges();
|
|
70
|
+
expect(component.type).toBe('number');
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
it('should have default tooltipPosition as bottom', () => {
|
|
74
|
+
expect(component.tooltipPosition).toBe('bottom');
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
it('should accept tooltipPosition input', () => {
|
|
78
|
+
component.tooltipPosition = 'top';
|
|
79
|
+
fixture.detectChanges();
|
|
80
|
+
expect(component.tooltipPosition).toBe('top');
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
it('should have default buttonText as empty string', () => {
|
|
84
|
+
expect(component.buttonText).toBe('');
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
it('should accept buttonText input', () => {
|
|
88
|
+
component.buttonText = 'Submit';
|
|
89
|
+
fixture.detectChanges();
|
|
90
|
+
expect(component.buttonText).toBe('Submit');
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
it('should have default buttonType as button', () => {
|
|
94
|
+
expect(component.buttonType).toBe('button');
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
it('should accept buttonType input', () => {
|
|
98
|
+
component.buttonType = 'submit';
|
|
99
|
+
fixture.detectChanges();
|
|
100
|
+
expect(component.buttonType).toBe('submit');
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
it('should have default isLabelRequired as false', () => {
|
|
104
|
+
expect(component.isLabelRequired).toBe(false);
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
it('should accept isLabelRequired input', () => {
|
|
108
|
+
component.isLabelRequired = true;
|
|
109
|
+
fixture.detectChanges();
|
|
110
|
+
expect(component.isLabelRequired).toBe(true);
|
|
111
|
+
});
|
|
112
|
+
|
|
113
|
+
it('should have default isLabelIconRequired as false', () => {
|
|
114
|
+
expect(component.isLabelIconRequired).toBe(false);
|
|
115
|
+
});
|
|
116
|
+
|
|
117
|
+
it('should accept isLabelIconRequired input', () => {
|
|
118
|
+
component.isLabelIconRequired = true;
|
|
119
|
+
fixture.detectChanges();
|
|
120
|
+
expect(component.isLabelIconRequired).toBe(true);
|
|
121
|
+
});
|
|
122
|
+
});
|
|
123
|
+
|
|
124
|
+
describe('changeValueHandler emission', () => {
|
|
125
|
+
it('should emit changeValueHandler when onInput is called', () => {
|
|
126
|
+
const emitSpy = jest.fn();
|
|
127
|
+
component.changeValueHandler.subscribe(emitSpy);
|
|
128
|
+
|
|
129
|
+
const mockEvent = { target: { value: 'new value' } } as unknown as Event;
|
|
130
|
+
component.onInput(mockEvent);
|
|
131
|
+
|
|
132
|
+
expect(emitSpy).toHaveBeenCalledWith('new value');
|
|
133
|
+
});
|
|
134
|
+
|
|
135
|
+
it('should emit empty string when input is cleared', () => {
|
|
136
|
+
const emitSpy = jest.fn();
|
|
137
|
+
component.changeValueHandler.subscribe(emitSpy);
|
|
138
|
+
|
|
139
|
+
const mockEvent = { target: { value: '' } } as unknown as Event;
|
|
140
|
+
component.onInput(mockEvent);
|
|
141
|
+
|
|
142
|
+
expect(emitSpy).toHaveBeenCalledWith('');
|
|
143
|
+
});
|
|
144
|
+
});
|
|
145
|
+
|
|
146
|
+
describe('buttonClick emission', () => {
|
|
147
|
+
it('should emit buttonClick when triggered', () => {
|
|
148
|
+
const emitSpy = jest.fn();
|
|
149
|
+
component.buttonClick.subscribe(emitSpy);
|
|
150
|
+
|
|
151
|
+
component.buttonClick.emit();
|
|
152
|
+
|
|
153
|
+
expect(emitSpy).toHaveBeenCalled();
|
|
154
|
+
});
|
|
155
|
+
});
|
|
156
|
+
});
|
package/src/lib/lib/atomix-form/atomix-form-input-component/atomix-form-input-component.component.ts
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { Component, EventEmitter, Input, Output } from '@angular/core';
|
|
2
|
+
import { FormControl, FormGroup } from '@angular/forms';
|
|
3
|
+
import { LabelIconData } from '../atomix-form-chips/form.chips.models';
|
|
4
|
+
|
|
5
|
+
@Component({
|
|
6
|
+
selector: 'atomix-form-input',
|
|
7
|
+
templateUrl: './atomix-form-input-component.component.html',
|
|
8
|
+
styleUrls: ['./atomix-form-input-component.component.scss'],
|
|
9
|
+
})
|
|
10
|
+
export class AtomixFormInputComponent {
|
|
11
|
+
@Input() controlName!: string;
|
|
12
|
+
@Input() form!: FormGroup;
|
|
13
|
+
@Input() label = '';
|
|
14
|
+
@Input() max!: number | null;
|
|
15
|
+
@Input() min!: number;
|
|
16
|
+
@Input() placeholder = '';
|
|
17
|
+
@Input() type = 'text';
|
|
18
|
+
@Input() tooltip!: string;
|
|
19
|
+
@Input() class!: string;
|
|
20
|
+
@Input() style: any;
|
|
21
|
+
@Input() isLabelIconData: LabelIconData = {
|
|
22
|
+
iconClass: '',
|
|
23
|
+
tooltip: '',
|
|
24
|
+
};
|
|
25
|
+
@Input() isLabelIconRequired: boolean = false;
|
|
26
|
+
@Input() isLabelRequired: boolean = false;
|
|
27
|
+
@Input() tooltipPosition: 'right' | 'left' | 'top' | 'bottom' = 'bottom';
|
|
28
|
+
@Input() buttonText: string = '';
|
|
29
|
+
@Input() buttonType: 'button' | 'submit' = 'button';
|
|
30
|
+
@Output() changeValueHandler = new EventEmitter<string>();
|
|
31
|
+
@Output() buttonClick = new EventEmitter<void>();
|
|
32
|
+
|
|
33
|
+
get control() {
|
|
34
|
+
return this.form.get(this.controlName) as FormControl;
|
|
35
|
+
}
|
|
36
|
+
onInput(event: Event): void {
|
|
37
|
+
console.log(this.buttonType);
|
|
38
|
+
const input = event.target as HTMLInputElement;
|
|
39
|
+
|
|
40
|
+
this.changeValueHandler.emit(input.value);
|
|
41
|
+
}
|
|
42
|
+
}
|