primekit 1.0.9 → 1.0.11
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 +15 -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
package/src/lib/lib/atomix-form/atomix-form-autocomplete/atomix-form-autocomplete.component.spec.ts
ADDED
|
@@ -0,0 +1,169 @@
|
|
|
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 { AtomixFormAutocompleteComponent } from './atomix-form-autocomplete.component';
|
|
5
|
+
|
|
6
|
+
describe('AtomixFormAutocompleteComponent', () => {
|
|
7
|
+
let component: AtomixFormAutocompleteComponent;
|
|
8
|
+
let fixture: ComponentFixture<AtomixFormAutocompleteComponent>;
|
|
9
|
+
|
|
10
|
+
beforeEach(() => {
|
|
11
|
+
TestBed.configureTestingModule({
|
|
12
|
+
declarations: [AtomixFormAutocompleteComponent],
|
|
13
|
+
imports: [ReactiveFormsModule],
|
|
14
|
+
schemas: [NO_ERRORS_SCHEMA],
|
|
15
|
+
});
|
|
16
|
+
fixture = TestBed.createComponent(AtomixFormAutocompleteComponent);
|
|
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('test value');
|
|
38
|
+
expect(component.control.value).toBe('test value');
|
|
39
|
+
});
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
describe('suggestions input', () => {
|
|
43
|
+
it('should have default suggestions as empty array', () => {
|
|
44
|
+
expect(component.suggestions).toEqual([]);
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
it('should accept suggestions input', () => {
|
|
48
|
+
const suggestions = [{ name: 'Option 1' }, { name: 'Option 2' }];
|
|
49
|
+
component.suggestions = suggestions;
|
|
50
|
+
expect(component.suggestions).toEqual(suggestions);
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
it('should accept string suggestions', () => {
|
|
54
|
+
const suggestions = ['Apple', 'Banana', 'Cherry'];
|
|
55
|
+
component.suggestions = suggestions;
|
|
56
|
+
expect(component.suggestions).toEqual(suggestions);
|
|
57
|
+
});
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
describe('selection updating form control', () => {
|
|
61
|
+
it('should update form control value when a selection is made', () => {
|
|
62
|
+
const selectedValue = { name: 'Selected Option' };
|
|
63
|
+
component.control.setValue(selectedValue);
|
|
64
|
+
expect(component.form.get('testField')!.value).toEqual(selectedValue);
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
it('should update form control value with a string selection', () => {
|
|
68
|
+
component.control.setValue('Selected String');
|
|
69
|
+
expect(component.form.get('testField')!.value).toBe('Selected String');
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
it('should clear form control value when cleared', () => {
|
|
73
|
+
component.control.setValue('some value');
|
|
74
|
+
component.control.setValue('');
|
|
75
|
+
expect(component.form.get('testField')!.value).toBe('');
|
|
76
|
+
});
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
describe('output events', () => {
|
|
80
|
+
it('should emit queryEvent when onQuery is called', () => {
|
|
81
|
+
jest.spyOn(component.queryEvent, 'emit');
|
|
82
|
+
const event = { query: 'search term' } as any;
|
|
83
|
+
component.onQuery(event);
|
|
84
|
+
expect(component.queryEvent.emit).toHaveBeenCalledWith('search term');
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
it('should emit onSelect when onOptionSelected is called', () => {
|
|
88
|
+
jest.spyOn(component.onSelect, 'emit');
|
|
89
|
+
const event = { value: { name: 'Option 1' } } as any;
|
|
90
|
+
component.onOptionSelected(event);
|
|
91
|
+
expect(component.onSelect.emit).toHaveBeenCalledWith(event);
|
|
92
|
+
});
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
describe('input properties', () => {
|
|
96
|
+
it('should have default label as empty string', () => {
|
|
97
|
+
expect(component.label).toBe('');
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
it('should accept label input', () => {
|
|
101
|
+
component.label = 'Search';
|
|
102
|
+
expect(component.label).toBe('Search');
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
it('should have default placeholder as empty string', () => {
|
|
106
|
+
expect(component.placeholder).toBe('');
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
it('should accept placeholder input', () => {
|
|
110
|
+
component.placeholder = 'Type to search';
|
|
111
|
+
expect(component.placeholder).toBe('Type to search');
|
|
112
|
+
});
|
|
113
|
+
|
|
114
|
+
it('should have default type as text', () => {
|
|
115
|
+
expect(component.type).toBe('text');
|
|
116
|
+
});
|
|
117
|
+
|
|
118
|
+
it('should accept type input', () => {
|
|
119
|
+
component.type = 'email';
|
|
120
|
+
expect(component.type).toBe('email');
|
|
121
|
+
});
|
|
122
|
+
|
|
123
|
+
it('should accept tooltip input', () => {
|
|
124
|
+
component.tooltip = 'Search for items';
|
|
125
|
+
expect(component.tooltip).toBe('Search for items');
|
|
126
|
+
});
|
|
127
|
+
|
|
128
|
+
it('should have default tooltipPosition as bottom', () => {
|
|
129
|
+
expect(component.tooltipPosition).toBe('bottom');
|
|
130
|
+
});
|
|
131
|
+
|
|
132
|
+
it('should accept tooltipPosition input', () => {
|
|
133
|
+
component.tooltipPosition = 'top';
|
|
134
|
+
expect(component.tooltipPosition).toBe('top');
|
|
135
|
+
});
|
|
136
|
+
|
|
137
|
+
it('should accept styleClass input', () => {
|
|
138
|
+
component.styleClass = 'custom-autocomplete';
|
|
139
|
+
expect(component.styleClass).toBe('custom-autocomplete');
|
|
140
|
+
});
|
|
141
|
+
|
|
142
|
+
it('should have default isLabelRequired as false', () => {
|
|
143
|
+
expect(component.isLabelRequired).toBe(false);
|
|
144
|
+
});
|
|
145
|
+
|
|
146
|
+
it('should accept isLabelRequired input', () => {
|
|
147
|
+
component.isLabelRequired = true;
|
|
148
|
+
expect(component.isLabelRequired).toBe(true);
|
|
149
|
+
});
|
|
150
|
+
|
|
151
|
+
it('should have default field as empty string', () => {
|
|
152
|
+
expect(component.field).toBe('');
|
|
153
|
+
});
|
|
154
|
+
|
|
155
|
+
it('should accept field input', () => {
|
|
156
|
+
component.field = 'name';
|
|
157
|
+
expect(component.field).toBe('name');
|
|
158
|
+
});
|
|
159
|
+
|
|
160
|
+
it('should have default dropdown as true', () => {
|
|
161
|
+
expect(component.dropdown).toBe(true);
|
|
162
|
+
});
|
|
163
|
+
|
|
164
|
+
it('should accept dropdown input', () => {
|
|
165
|
+
component.dropdown = false;
|
|
166
|
+
expect(component.dropdown).toBe(false);
|
|
167
|
+
});
|
|
168
|
+
});
|
|
169
|
+
});
|
package/src/lib/lib/atomix-form/atomix-form-autocomplete/atomix-form-autocomplete.component.ts
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { Component, EventEmitter, Input, Output } from '@angular/core';
|
|
2
|
+
import { FormControl, FormGroup } from '@angular/forms';
|
|
3
|
+
import {
|
|
4
|
+
AutoCompleteCompleteEvent,
|
|
5
|
+
AutoCompleteSelectEvent,
|
|
6
|
+
} from 'primeng/autocomplete';
|
|
7
|
+
|
|
8
|
+
@Component({
|
|
9
|
+
selector: 'atomix-form-autocomplete',
|
|
10
|
+
templateUrl: './atomix-form-autocomplete.component.html',
|
|
11
|
+
styleUrls: ['./atomix-form-autocomplete.component.scss'],
|
|
12
|
+
})
|
|
13
|
+
export class AtomixFormAutocompleteComponent {
|
|
14
|
+
@Input() controlName!: string;
|
|
15
|
+
@Input() form!: FormGroup;
|
|
16
|
+
@Input() label = '';
|
|
17
|
+
@Input() suggestions: any[] = [];
|
|
18
|
+
@Input() placeholder = '';
|
|
19
|
+
@Input() type = 'text';
|
|
20
|
+
@Input() tooltip!: string;
|
|
21
|
+
@Input() styleClass!: string;
|
|
22
|
+
@Input() isLabelRequired: boolean = false;
|
|
23
|
+
@Input() tooltipPosition: 'right' | 'left' | 'top' | 'bottom' = 'bottom';
|
|
24
|
+
@Input() field: string = '';
|
|
25
|
+
@Input() dropdown = true;
|
|
26
|
+
@Output() queryEvent = new EventEmitter<string>();
|
|
27
|
+
@Output() onSelect = new EventEmitter<AutoCompleteSelectEvent | Event>();
|
|
28
|
+
|
|
29
|
+
onQuery(event: AutoCompleteCompleteEvent) {
|
|
30
|
+
this.queryEvent.emit(event.query);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
onOptionSelected(event: AutoCompleteSelectEvent) {
|
|
34
|
+
console.log('lib', event);
|
|
35
|
+
this.onSelect.emit(event);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
get control() {
|
|
39
|
+
return this.form.get(this.controlName) as FormControl;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
<label *ngIf="label" [for]="controlName"
|
|
2
|
+
>{{ label }}
|
|
3
|
+
<span *ngIf="isLabelRequired" class="error-asterisk">*</span></label
|
|
4
|
+
>
|
|
5
|
+
<p-calendar
|
|
6
|
+
[formControl]="control"
|
|
7
|
+
id="calendar"
|
|
8
|
+
tooltipPosition="top"
|
|
9
|
+
[view]="view"
|
|
10
|
+
[dateFormat]="dateFormat"
|
|
11
|
+
[maxDate]="maxDate"
|
|
12
|
+
[minDate]="minDate"
|
|
13
|
+
[selectionMode]="selectionMode"
|
|
14
|
+
[readonlyInput]="true"
|
|
15
|
+
[placeholder]="placeholder"
|
|
16
|
+
(onClose)="dateSelectHandler.emit()"
|
|
17
|
+
[inputStyleClass]="inputStyleClass"
|
|
18
|
+
[styleClass]="styleClass + ' form-calendar'"
|
|
19
|
+
appendTo="body"
|
|
20
|
+
(onSelect)="dateChangeHandler.emit($event)"
|
|
21
|
+
/>
|
|
@@ -0,0 +1,142 @@
|
|
|
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 { AtomixFormCalendarComponent } from './atomix-form-calendar.component';
|
|
5
|
+
|
|
6
|
+
describe('AtomixFormCalendarComponent', () => {
|
|
7
|
+
let component: AtomixFormCalendarComponent;
|
|
8
|
+
let fixture: ComponentFixture<AtomixFormCalendarComponent>;
|
|
9
|
+
|
|
10
|
+
beforeEach(() => {
|
|
11
|
+
TestBed.configureTestingModule({
|
|
12
|
+
declarations: [AtomixFormCalendarComponent],
|
|
13
|
+
imports: [ReactiveFormsModule],
|
|
14
|
+
schemas: [NO_ERRORS_SCHEMA],
|
|
15
|
+
});
|
|
16
|
+
fixture = TestBed.createComponent(AtomixFormCalendarComponent);
|
|
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('2024-01-15');
|
|
38
|
+
expect(component.control.value).toBe('2024-01-15');
|
|
39
|
+
});
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
describe('date selection updating form control', () => {
|
|
43
|
+
it('should update form control value when set programmatically', () => {
|
|
44
|
+
const date = new Date(2024, 5, 15);
|
|
45
|
+
component.control.setValue(date);
|
|
46
|
+
expect(component.form.get('testField')!.value).toBe(date);
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
it('should emit dateSelectHandler on calendar close', () => {
|
|
50
|
+
const emitSpy = jest.fn();
|
|
51
|
+
component.dateSelectHandler.subscribe(emitSpy);
|
|
52
|
+
|
|
53
|
+
component.dateSelectHandler.emit();
|
|
54
|
+
|
|
55
|
+
expect(emitSpy).toHaveBeenCalled();
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
it('should emit dateChangeHandler on date select', () => {
|
|
59
|
+
const emitSpy = jest.fn();
|
|
60
|
+
component.dateChangeHandler.subscribe(emitSpy);
|
|
61
|
+
|
|
62
|
+
const mockDate = new Date(2024, 5, 15);
|
|
63
|
+
component.dateChangeHandler.emit(mockDate);
|
|
64
|
+
|
|
65
|
+
expect(emitSpy).toHaveBeenCalledWith(mockDate);
|
|
66
|
+
});
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
describe('input properties', () => {
|
|
70
|
+
it('should have default label as empty string', () => {
|
|
71
|
+
expect(component.label).toBe('');
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
it('should accept label input', () => {
|
|
75
|
+
component.label = 'Start Date';
|
|
76
|
+
expect(component.label).toBe('Start Date');
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
it('should have default isLabelRequired as false', () => {
|
|
80
|
+
expect(component.isLabelRequired).toBe(false);
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
it('should accept isLabelRequired input', () => {
|
|
84
|
+
component.isLabelRequired = true;
|
|
85
|
+
expect(component.isLabelRequired).toBe(true);
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
it('should have default placeholder as empty string', () => {
|
|
89
|
+
expect(component.placeholder).toBe('');
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
it('should accept placeholder input', () => {
|
|
93
|
+
component.placeholder = 'Select a date';
|
|
94
|
+
expect(component.placeholder).toBe('Select a date');
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
it('should accept view input', () => {
|
|
98
|
+
component.view = 'month';
|
|
99
|
+
expect(component.view).toBe('month');
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
it('should accept dateFormat input', () => {
|
|
103
|
+
component.dateFormat = 'mm/dd/yy';
|
|
104
|
+
expect(component.dateFormat).toBe('mm/dd/yy');
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
it('should accept maxDate input', () => {
|
|
108
|
+
const maxDate = new Date(2025, 11, 31);
|
|
109
|
+
component.maxDate = maxDate;
|
|
110
|
+
expect(component.maxDate).toBe(maxDate);
|
|
111
|
+
});
|
|
112
|
+
|
|
113
|
+
it('should accept minDate input', () => {
|
|
114
|
+
const minDate = new Date(2020, 0, 1);
|
|
115
|
+
component.minDate = minDate;
|
|
116
|
+
expect(component.minDate).toBe(minDate);
|
|
117
|
+
});
|
|
118
|
+
|
|
119
|
+
it('should accept selectionMode input', () => {
|
|
120
|
+
component.selectionMode = 'range';
|
|
121
|
+
expect(component.selectionMode).toBe('range');
|
|
122
|
+
});
|
|
123
|
+
|
|
124
|
+
it('should have default styleClass as empty string', () => {
|
|
125
|
+
expect(component.styleClass).toBe('');
|
|
126
|
+
});
|
|
127
|
+
|
|
128
|
+
it('should accept styleClass input', () => {
|
|
129
|
+
component.styleClass = 'custom-calendar';
|
|
130
|
+
expect(component.styleClass).toBe('custom-calendar');
|
|
131
|
+
});
|
|
132
|
+
|
|
133
|
+
it('should have default inputStyleClass as empty string', () => {
|
|
134
|
+
expect(component.inputStyleClass).toBe('');
|
|
135
|
+
});
|
|
136
|
+
|
|
137
|
+
it('should accept inputStyleClass input', () => {
|
|
138
|
+
component.inputStyleClass = 'custom-input';
|
|
139
|
+
expect(component.inputStyleClass).toBe('custom-input');
|
|
140
|
+
});
|
|
141
|
+
});
|
|
142
|
+
});
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { Component, EventEmitter, Input, Output } from '@angular/core';
|
|
2
|
+
import { FormControl, FormGroup } from '@angular/forms';
|
|
3
|
+
import { CalendarTypeView } from 'primeng/calendar';
|
|
4
|
+
|
|
5
|
+
@Component({
|
|
6
|
+
selector: 'atomix-form-calendar',
|
|
7
|
+
templateUrl: './atomix-form-calendar.component.html',
|
|
8
|
+
styleUrls: ['./atomix-form-calendar.component.scss'],
|
|
9
|
+
})
|
|
10
|
+
export class AtomixFormCalendarComponent {
|
|
11
|
+
@Input() controlName!: string;
|
|
12
|
+
@Input() form!: FormGroup;
|
|
13
|
+
@Input() view!: CalendarTypeView;
|
|
14
|
+
@Input() dateFormat!: string;
|
|
15
|
+
@Input() label = '';
|
|
16
|
+
@Input() isLabelRequired: boolean = false;
|
|
17
|
+
|
|
18
|
+
@Input() maxDate!: Date;
|
|
19
|
+
@Input() minDate!: Date;
|
|
20
|
+
@Input() selectionMode!: 'single' | 'multiple' | 'range' | undefined;
|
|
21
|
+
@Input() placeholder = '';
|
|
22
|
+
|
|
23
|
+
@Input() styleClass = '';
|
|
24
|
+
@Input() inputStyleClass = '';
|
|
25
|
+
|
|
26
|
+
@Output() dateSelectHandler = new EventEmitter<any>();
|
|
27
|
+
@Output() dateChangeHandler = new EventEmitter<any>();
|
|
28
|
+
|
|
29
|
+
get control() {
|
|
30
|
+
return this.form.get(this.controlName) as FormControl;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<div [ngClass]="inline ? 'checkbox-item-inline' : 'checkbox-item'">
|
|
2
|
+
<label [htmlFor]="controlName" *ngIf="label" [htmlFor]="controlName">{{
|
|
3
|
+
label
|
|
4
|
+
}}</label>
|
|
5
|
+
<p-checkbox
|
|
6
|
+
[binary]="true"
|
|
7
|
+
[formControl]="control"
|
|
8
|
+
[inputId]="controlName"
|
|
9
|
+
[pTooltip]="tooltip"
|
|
10
|
+
[tooltipPosition]="tooltipPosition"
|
|
11
|
+
(onChange)="onChange($event)"
|
|
12
|
+
></p-checkbox>
|
|
13
|
+
</div>
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
.checkbox-item {
|
|
2
|
+
min-height: 72px !important;
|
|
3
|
+
display: flex;
|
|
4
|
+
justify-content: space-evenly;
|
|
5
|
+
flex-direction: column;
|
|
6
|
+
gap: 0.5rem;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.checkbox-item-inline {
|
|
10
|
+
display: flex;
|
|
11
|
+
justify-content: flex-end;
|
|
12
|
+
flex-direction: row-reverse;
|
|
13
|
+
gap: 0.5rem;
|
|
14
|
+
}
|
|
@@ -0,0 +1,112 @@
|
|
|
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 { AtomixFormCheckboxComponent } from './atomix-form-checkbox.component';
|
|
5
|
+
|
|
6
|
+
describe('AtomixFormCheckboxComponent', () => {
|
|
7
|
+
let component: AtomixFormCheckboxComponent;
|
|
8
|
+
let fixture: ComponentFixture<AtomixFormCheckboxComponent>;
|
|
9
|
+
|
|
10
|
+
beforeEach(() => {
|
|
11
|
+
TestBed.configureTestingModule({
|
|
12
|
+
declarations: [AtomixFormCheckboxComponent],
|
|
13
|
+
imports: [ReactiveFormsModule],
|
|
14
|
+
schemas: [NO_ERRORS_SCHEMA],
|
|
15
|
+
});
|
|
16
|
+
fixture = TestBed.createComponent(AtomixFormCheckboxComponent);
|
|
17
|
+
component = fixture.componentInstance;
|
|
18
|
+
component.form = new FormGroup({ testField: new FormControl(false) });
|
|
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(true);
|
|
38
|
+
expect(component.control.value).toBe(true);
|
|
39
|
+
});
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
describe('checkbox toggle updating form control', () => {
|
|
43
|
+
it('should update form control value when toggled to true', () => {
|
|
44
|
+
component.control.setValue(true);
|
|
45
|
+
expect(component.form.get('testField')!.value).toBe(true);
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
it('should update form control value when toggled to false', () => {
|
|
49
|
+
component.control.setValue(true);
|
|
50
|
+
component.control.setValue(false);
|
|
51
|
+
expect(component.form.get('testField')!.value).toBe(false);
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
it('should emit valueChange on onChange', () => {
|
|
55
|
+
const emitSpy = jest.fn();
|
|
56
|
+
component.valueChange.subscribe(emitSpy);
|
|
57
|
+
|
|
58
|
+
const mockEvent = { checked: true };
|
|
59
|
+
component.onChange(mockEvent);
|
|
60
|
+
|
|
61
|
+
expect(emitSpy).toHaveBeenCalledWith(mockEvent);
|
|
62
|
+
});
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
describe('input properties', () => {
|
|
66
|
+
it('should have default binary as false', () => {
|
|
67
|
+
expect(component.binary).toBe(false);
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
it('should accept binary input', () => {
|
|
71
|
+
component.binary = true;
|
|
72
|
+
expect(component.binary).toBe(true);
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
it('should have default inline as false', () => {
|
|
76
|
+
expect(component.inline).toBe(false);
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
it('should accept inline input', () => {
|
|
80
|
+
component.inline = true;
|
|
81
|
+
expect(component.inline).toBe(true);
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
it('should have default label as empty string', () => {
|
|
85
|
+
expect(component.label).toBe('');
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
it('should accept label input', () => {
|
|
89
|
+
component.label = 'Accept Terms';
|
|
90
|
+
expect(component.label).toBe('Accept Terms');
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
it('should accept tooltip input', () => {
|
|
94
|
+
component.tooltip = 'Check to agree';
|
|
95
|
+
expect(component.tooltip).toBe('Check to agree');
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
it('should have default tooltipPosition as bottom', () => {
|
|
99
|
+
expect(component.tooltipPosition).toBe('bottom');
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
it('should accept tooltipPosition input', () => {
|
|
103
|
+
component.tooltipPosition = 'top';
|
|
104
|
+
expect(component.tooltipPosition).toBe('top');
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
it('should accept value input', () => {
|
|
108
|
+
component.value = 'option1';
|
|
109
|
+
expect(component.value).toBe('option1');
|
|
110
|
+
});
|
|
111
|
+
});
|
|
112
|
+
});
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { Component, EventEmitter, Input, Output } from '@angular/core';
|
|
2
|
+
import { FormControl, FormGroup } from '@angular/forms';
|
|
3
|
+
|
|
4
|
+
@Component({
|
|
5
|
+
selector: 'atomix-form-checkbox',
|
|
6
|
+
templateUrl: './atomix-form-checkbox.component.html',
|
|
7
|
+
styleUrls: ['./atomix-form-checkbox.component.scss'],
|
|
8
|
+
})
|
|
9
|
+
export class AtomixFormCheckboxComponent {
|
|
10
|
+
@Input() binary = false;
|
|
11
|
+
@Input() controlName!: string;
|
|
12
|
+
@Input() form!: FormGroup;
|
|
13
|
+
@Input() inline = false;
|
|
14
|
+
@Input() label = '';
|
|
15
|
+
@Input() tooltip!: string;
|
|
16
|
+
@Input() tooltipPosition: 'right' | 'left' | 'top' | 'bottom' = 'bottom';
|
|
17
|
+
@Input() value!: string;
|
|
18
|
+
|
|
19
|
+
@Output() valueChange = new EventEmitter();
|
|
20
|
+
|
|
21
|
+
get control() {
|
|
22
|
+
return this.form.get(this.controlName) as FormControl;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
onChange(event: any) {
|
|
26
|
+
this.valueChange.emit(event);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
<div class="item flex flex-column">
|
|
2
|
+
<label *ngIf="label" [htmlFor]="controlName"
|
|
3
|
+
>{{ label }}
|
|
4
|
+
<i
|
|
5
|
+
*ngIf="isLabelIconRequired"
|
|
6
|
+
[class]="isLabelIconData?.iconClass + ' ml-2'"
|
|
7
|
+
[pTooltip]="isLabelIconData?.tooltip"
|
|
8
|
+
></i
|
|
9
|
+
></label>
|
|
10
|
+
<p-chips
|
|
11
|
+
separator=","
|
|
12
|
+
placeholder="Separate values with a comma or enter."
|
|
13
|
+
[formControl]="control"
|
|
14
|
+
[id]="controlName"
|
|
15
|
+
[pTooltip]="tooltip"
|
|
16
|
+
[tooltipPosition]="tooltipPosition"
|
|
17
|
+
[styleClass]="styleClass + ' lib-form-chips'"
|
|
18
|
+
[allowDuplicate]="allowDuplicate"
|
|
19
|
+
></p-chips>
|
|
20
|
+
</div>
|