@cauca-911/material 20.2.13 → 20.2.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (246) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +3 -22
  3. package/fesm2022/cauca-911-material.mjs +4639 -0
  4. package/fesm2022/cauca-911-material.mjs.map +1 -0
  5. package/package.json +38 -23
  6. package/types/cauca-911-material.d.ts +796 -0
  7. package/.eslintrc.json +0 -77
  8. package/README_PACKAGE.md +0 -5
  9. package/karma.conf.js +0 -50
  10. package/ng-package.json +0 -7
  11. package/src/lib/cauca-material.component.html +0 -1
  12. package/src/lib/cauca-material.component.spec.ts +0 -29
  13. package/src/lib/cauca-material.component.ts +0 -12
  14. package/src/lib/cauca-material.service.spec.ts +0 -16
  15. package/src/lib/cauca-material.service.ts +0 -7
  16. package/src/lib/components/button/button.component.html +0 -52
  17. package/src/lib/components/button/button.component.scss +0 -6
  18. package/src/lib/components/button/button.component.spec.ts +0 -134
  19. package/src/lib/components/button/button.component.ts +0 -21
  20. package/src/lib/components/buttons/base-button.ts +0 -35
  21. package/src/lib/components/buttons/basic-button/basic-button.component.html +0 -5
  22. package/src/lib/components/buttons/basic-button/basic-button.component.scss +0 -12
  23. package/src/lib/components/buttons/basic-button/basic-button.component.spec.ts +0 -106
  24. package/src/lib/components/buttons/basic-button/basic-button.component.ts +0 -17
  25. package/src/lib/components/buttons/fab-button/fab-button.component.html +0 -3
  26. package/src/lib/components/buttons/fab-button/fab-button.component.scss +0 -12
  27. package/src/lib/components/buttons/fab-button/fab-button.component.spec.ts +0 -82
  28. package/src/lib/components/buttons/fab-button/fab-button.component.ts +0 -16
  29. package/src/lib/components/buttons/flat-button/flat-button.component.html +0 -5
  30. package/src/lib/components/buttons/flat-button/flat-button.component.scss +0 -12
  31. package/src/lib/components/buttons/flat-button/flat-button.component.spec.ts +0 -106
  32. package/src/lib/components/buttons/flat-button/flat-button.component.ts +0 -17
  33. package/src/lib/components/buttons/icon-button/icon-button.component.html +0 -3
  34. package/src/lib/components/buttons/icon-button/icon-button.component.scss +0 -23
  35. package/src/lib/components/buttons/icon-button/icon-button.component.spec.ts +0 -38
  36. package/src/lib/components/buttons/icon-button/icon-button.component.ts +0 -15
  37. package/src/lib/components/buttons/link-button/link-button.component.html +0 -1
  38. package/src/lib/components/buttons/link-button/link-button.component.scss +0 -3
  39. package/src/lib/components/buttons/link-button/link-button.component.spec.ts +0 -97
  40. package/src/lib/components/buttons/link-button/link-button.component.ts +0 -25
  41. package/src/lib/components/buttons/menu-item/menu-item.component.html +0 -5
  42. package/src/lib/components/buttons/menu-item/menu-item.component.scss +0 -6
  43. package/src/lib/components/buttons/menu-item/menu-item.component.spec.ts +0 -66
  44. package/src/lib/components/buttons/menu-item/menu-item.component.ts +0 -19
  45. package/src/lib/components/buttons/raised-button/raised-button.component.html +0 -5
  46. package/src/lib/components/buttons/raised-button/raised-button.component.scss +0 -12
  47. package/src/lib/components/buttons/raised-button/raised-button.component.spec.ts +0 -108
  48. package/src/lib/components/buttons/raised-button/raised-button.component.ts +0 -17
  49. package/src/lib/components/buttons/refresh-button/refresh-button.component.html +0 -1
  50. package/src/lib/components/buttons/refresh-button/refresh-button.component.scss +0 -0
  51. package/src/lib/components/buttons/refresh-button/refresh-button.component.spec.ts +0 -81
  52. package/src/lib/components/buttons/refresh-button/refresh-button.component.ts +0 -19
  53. package/src/lib/components/buttons/round-button/round-button.component.html +0 -3
  54. package/src/lib/components/buttons/round-button/round-button.component.scss +0 -34
  55. package/src/lib/components/buttons/round-button/round-button.component.spec.ts +0 -26
  56. package/src/lib/components/buttons/round-button/round-button.component.ts +0 -14
  57. package/src/lib/components/buttons/stroked-button/stroked-button.component.html +0 -5
  58. package/src/lib/components/buttons/stroked-button/stroked-button.component.scss +0 -23
  59. package/src/lib/components/buttons/stroked-button/stroked-button.component.spec.ts +0 -114
  60. package/src/lib/components/buttons/stroked-button/stroked-button.component.ts +0 -17
  61. package/src/lib/components/cauca-date-time-picker/cauca-date-time-picker.component.html +0 -9
  62. package/src/lib/components/cauca-date-time-picker/cauca-date-time-picker.component.scss +0 -7
  63. package/src/lib/components/cauca-date-time-picker/cauca-date-time-picker.component.spec.ts +0 -68
  64. package/src/lib/components/cauca-date-time-picker/cauca-date-time-picker.component.ts +0 -155
  65. package/src/lib/components/cauca-date-time-picker/components/desktop-time-picker/desktop-time-picker.component.html +0 -6
  66. package/src/lib/components/cauca-date-time-picker/components/desktop-time-picker/desktop-time-picker.component.scss +0 -25
  67. package/src/lib/components/cauca-date-time-picker/components/desktop-time-picker/desktop-time-picker.component.spec.ts +0 -23
  68. package/src/lib/components/cauca-date-time-picker/components/desktop-time-picker/desktop-time-picker.component.ts +0 -23
  69. package/src/lib/components/cauca-date-time-picker/components/dialog-date-time-picker/dialog-date-time-picker.component.html +0 -53
  70. package/src/lib/components/cauca-date-time-picker/components/dialog-date-time-picker/dialog-date-time-picker.component.scss +0 -124
  71. package/src/lib/components/cauca-date-time-picker/components/dialog-date-time-picker/dialog-date-time-picker.component.spec.ts +0 -93
  72. package/src/lib/components/cauca-date-time-picker/components/dialog-date-time-picker/dialog-date-time-picker.component.ts +0 -227
  73. package/src/lib/components/cauca-date-time-picker/components/mobile-time-picker/mobile-time-picker.component.html +0 -9
  74. package/src/lib/components/cauca-date-time-picker/components/mobile-time-picker/mobile-time-picker.component.scss +0 -15
  75. package/src/lib/components/cauca-date-time-picker/components/mobile-time-picker/mobile-time-picker.component.spec.ts +0 -103
  76. package/src/lib/components/cauca-date-time-picker/components/mobile-time-picker/mobile-time-picker.component.ts +0 -47
  77. package/src/lib/components/cauca-date-time-picker/models/dialog-date-time-picker-data.ts +0 -29
  78. package/src/lib/components/deprecated-components/cauca-input-file/cauca-input-file.component.html +0 -11
  79. package/src/lib/components/deprecated-components/cauca-input-file/cauca-input-file.component.scss +0 -3
  80. package/src/lib/components/deprecated-components/cauca-input-file/cauca-input-file.component.ts +0 -87
  81. package/src/lib/components/deprecated-components/cauca-input-multiple-langue/cauca-input-multiple-langue.component.html +0 -8
  82. package/src/lib/components/deprecated-components/cauca-input-multiple-langue/cauca-input-multiple-langue.component.scss +0 -3
  83. package/src/lib/components/deprecated-components/cauca-input-multiple-langue/cauca-input-multiple-langue.component.spec.ts +0 -35
  84. package/src/lib/components/deprecated-components/cauca-input-multiple-langue/cauca-input-multiple-langue.component.ts +0 -57
  85. package/src/lib/components/deprecated-components/cauca-menu-sidebar/cauca-menu-sidebar.component.html +0 -19
  86. package/src/lib/components/deprecated-components/cauca-menu-sidebar/cauca-menu-sidebar.component.scss +0 -142
  87. package/src/lib/components/deprecated-components/cauca-menu-sidebar/cauca-menu-sidebar.component.spec.ts +0 -30
  88. package/src/lib/components/deprecated-components/cauca-menu-sidebar/cauca-menu-sidebar.component.ts +0 -112
  89. package/src/lib/components/deprecated-components/cauca-menu-vertical/cauca-menu-vertical.component.html +0 -26
  90. package/src/lib/components/deprecated-components/cauca-menu-vertical/cauca-menu-vertical.component.scss +0 -52
  91. package/src/lib/components/deprecated-components/cauca-menu-vertical/cauca-menu-vertical.component.spec.ts +0 -28
  92. package/src/lib/components/deprecated-components/cauca-menu-vertical/cauca-menu-vertical.component.ts +0 -53
  93. package/src/lib/components/deprecated-components/cauca-simple-dialog/cauca-simple-dialog.component.html +0 -7
  94. package/src/lib/components/deprecated-components/cauca-simple-dialog/cauca-simple-dialog.component.scss +0 -4
  95. package/src/lib/components/deprecated-components/cauca-simple-dialog/cauca-simple-dialog.component.spec.ts +0 -39
  96. package/src/lib/components/deprecated-components/cauca-simple-dialog/cauca-simple-dialog.component.ts +0 -20
  97. package/src/lib/components/deprecated-components/cauca-slideshow/cauca-slideshow.component.html +0 -7
  98. package/src/lib/components/deprecated-components/cauca-slideshow/cauca-slideshow.component.scss +0 -41
  99. package/src/lib/components/deprecated-components/cauca-slideshow/cauca-slideshow.component.spec.ts +0 -24
  100. package/src/lib/components/deprecated-components/cauca-slideshow/cauca-slideshow.component.ts +0 -67
  101. package/src/lib/components/deprecated-components/shared/models/menu-item.ts +0 -11
  102. package/src/lib/components/deprecated-components/shared/models/simple-dialog-data.ts +0 -5
  103. package/src/lib/components/dialogs/alert-dialog/alert-dialog.component.html +0 -10
  104. package/src/lib/components/dialogs/alert-dialog/alert-dialog.component.scss +0 -14
  105. package/src/lib/components/dialogs/alert-dialog/alert-dialog.component.spec.ts +0 -90
  106. package/src/lib/components/dialogs/alert-dialog/alert-dialog.component.ts +0 -41
  107. package/src/lib/components/dialogs/confirm-dialog/confirm-dialog.component.html +0 -11
  108. package/src/lib/components/dialogs/confirm-dialog/confirm-dialog.component.scss +0 -29
  109. package/src/lib/components/dialogs/confirm-dialog/confirm-dialog.component.spec.ts +0 -137
  110. package/src/lib/components/dialogs/confirm-dialog/confirm-dialog.component.ts +0 -47
  111. package/src/lib/components/dialogs/delete-dialog/delete-dialog.component.html +0 -17
  112. package/src/lib/components/dialogs/delete-dialog/delete-dialog.component.scss +0 -14
  113. package/src/lib/components/dialogs/delete-dialog/delete-dialog.component.spec.ts +0 -96
  114. package/src/lib/components/dialogs/delete-dialog/delete-dialog.component.ts +0 -40
  115. package/src/lib/components/dialogs/delete-dialog/models/delete-dialog-data.spec.ts +0 -7
  116. package/src/lib/components/dialogs/delete-dialog/models/delete-dialog-data.ts +0 -5
  117. package/src/lib/components/dialogs/dialog-styles.css +0 -9
  118. package/src/lib/components/dialogs/dialog-styles.scss +0 -9
  119. package/src/lib/components/dialogs/error-dialog/error-dialog.component.html +0 -10
  120. package/src/lib/components/dialogs/error-dialog/error-dialog.component.scss +0 -10
  121. package/src/lib/components/dialogs/error-dialog/error-dialog.component.spec.ts +0 -91
  122. package/src/lib/components/dialogs/error-dialog/error-dialog.component.ts +0 -32
  123. package/src/lib/components/dialogs/services/dialog.service.spec.ts +0 -82
  124. package/src/lib/components/dialogs/services/dialog.service.ts +0 -107
  125. package/src/lib/components/dialogs/text-input-dialog/text-input-dialog.component.html +0 -24
  126. package/src/lib/components/dialogs/text-input-dialog/text-input-dialog.component.scss +0 -22
  127. package/src/lib/components/dialogs/text-input-dialog/text-input-dialog.component.spec.ts +0 -126
  128. package/src/lib/components/dialogs/text-input-dialog/text-input-dialog.component.ts +0 -66
  129. package/src/lib/components/inputs/color-picker/color-picker.component.html +0 -9
  130. package/src/lib/components/inputs/color-picker/color-picker.component.scss +0 -0
  131. package/src/lib/components/inputs/color-picker/color-picker.component.spec.ts +0 -29
  132. package/src/lib/components/inputs/color-picker/color-picker.component.ts +0 -111
  133. package/src/lib/components/inputs/date-range-picker/date-range-picker.component.html +0 -13
  134. package/src/lib/components/inputs/date-range-picker/date-range-picker.component.scss +0 -0
  135. package/src/lib/components/inputs/date-range-picker/date-range-picker.component.spec.ts +0 -80
  136. package/src/lib/components/inputs/date-range-picker/date-range-picker.component.ts +0 -46
  137. package/src/lib/components/inputs/dropdown-chip-autocomplete/dropdown-chip-autocomplete.component.html +0 -40
  138. package/src/lib/components/inputs/dropdown-chip-autocomplete/dropdown-chip-autocomplete.component.scss +0 -39
  139. package/src/lib/components/inputs/dropdown-chip-autocomplete/dropdown-chip-autocomplete.component.spec.ts +0 -135
  140. package/src/lib/components/inputs/dropdown-chip-autocomplete/dropdown-chip-autocomplete.component.ts +0 -263
  141. package/src/lib/components/inputs/password/password-criteria/password-criteria.component.html +0 -6
  142. package/src/lib/components/inputs/password/password-criteria/password-criteria.component.scss +0 -27
  143. package/src/lib/components/inputs/password/password-criteria/password-criteria.component.spec.ts +0 -90
  144. package/src/lib/components/inputs/password/password-criteria/password-criteria.component.ts +0 -17
  145. package/src/lib/components/inputs/password/password-criteria-viewer/password-criteria-viewer.component.html +0 -5
  146. package/src/lib/components/inputs/password/password-criteria-viewer/password-criteria-viewer.component.scss +0 -8
  147. package/src/lib/components/inputs/password/password-criteria-viewer/password-criteria-viewer.component.spec.ts +0 -98
  148. package/src/lib/components/inputs/password/password-criteria-viewer/password-criteria-viewer.component.ts +0 -16
  149. package/src/lib/components/inputs/password/password-input/password-input.component.html +0 -11
  150. package/src/lib/components/inputs/password/password-input/password-input.component.scss +0 -12
  151. package/src/lib/components/inputs/password/password-input/password-input.component.spec.ts +0 -141
  152. package/src/lib/components/inputs/password/password-input/password-input.component.ts +0 -67
  153. package/src/lib/components/inputs/password/password-selection/password-selection.component.html +0 -15
  154. package/src/lib/components/inputs/password/password-selection/password-selection.component.scss +0 -32
  155. package/src/lib/components/inputs/password/password-selection/password-selection.component.spec.ts +0 -138
  156. package/src/lib/components/inputs/password/password-selection/password-selection.component.ts +0 -100
  157. package/src/lib/components/inputs/select-with-search/select-with-search.component.html +0 -19
  158. package/src/lib/components/inputs/select-with-search/select-with-search.component.scss +0 -0
  159. package/src/lib/components/inputs/select-with-search/select-with-search.component.spec.ts +0 -213
  160. package/src/lib/components/inputs/select-with-search/select-with-search.component.ts +0 -108
  161. package/src/lib/components/layout/expandable-panel/expandable-panel.component.html +0 -12
  162. package/src/lib/components/layout/expandable-panel/expandable-panel.component.scss +0 -43
  163. package/src/lib/components/layout/expandable-panel/expandable-panel.component.spec.ts +0 -48
  164. package/src/lib/components/layout/expandable-panel/expandable-panel.component.ts +0 -19
  165. package/src/lib/components/layout/group-container/group-container.component.html +0 -6
  166. package/src/lib/components/layout/group-container/group-container.component.scss +0 -22
  167. package/src/lib/components/layout/group-container/group-container.component.spec.ts +0 -34
  168. package/src/lib/components/layout/group-container/group-container.component.ts +0 -14
  169. package/src/lib/components/layout/menu-expandable-panel/menu-expandable-panel.component.html +0 -13
  170. package/src/lib/components/layout/menu-expandable-panel/menu-expandable-panel.component.scss +0 -27
  171. package/src/lib/components/layout/menu-expandable-panel/menu-expandable-panel.component.spec.ts +0 -144
  172. package/src/lib/components/layout/menu-expandable-panel/menu-expandable-panel.component.ts +0 -52
  173. package/src/lib/components/layout/menu-expandable-panel-item/menu-expandable-panel-item.component.html +0 -4
  174. package/src/lib/components/layout/menu-expandable-panel-item/menu-expandable-panel-item.component.scss +0 -10
  175. package/src/lib/components/layout/menu-expandable-panel-item/menu-expandable-panel-item.component.spec.ts +0 -80
  176. package/src/lib/components/layout/menu-expandable-panel-item/menu-expandable-panel-item.component.ts +0 -28
  177. package/src/lib/components/layout/page-title/page-title.component.html +0 -28
  178. package/src/lib/components/layout/page-title/page-title.component.scss +0 -40
  179. package/src/lib/components/layout/page-title/page-title.component.spec.ts +0 -162
  180. package/src/lib/components/layout/page-title/page-title.component.ts +0 -28
  181. package/src/lib/components/layout/sections/main-section/main-section.component.html +0 -6
  182. package/src/lib/components/layout/sections/main-section/main-section.component.scss +0 -27
  183. package/src/lib/components/layout/sections/main-section/main-section.component.spec.ts +0 -42
  184. package/src/lib/components/layout/sections/main-section/main-section.component.ts +0 -13
  185. package/src/lib/components/layout/sections/section-column/section-column.component.html +0 -3
  186. package/src/lib/components/layout/sections/section-column/section-column.component.scss +0 -18
  187. package/src/lib/components/layout/sections/section-column/section-column.component.spec.ts +0 -35
  188. package/src/lib/components/layout/sections/section-column/section-column.component.ts +0 -12
  189. package/src/lib/components/layout/sections/section-field/section-field.component.html +0 -21
  190. package/src/lib/components/layout/sections/section-field/section-field.component.scss +0 -44
  191. package/src/lib/components/layout/sections/section-field/section-field.component.spec.ts +0 -74
  192. package/src/lib/components/layout/sections/section-field/section-field.component.ts +0 -22
  193. package/src/lib/components/list-paginator/list-paginator.component.html +0 -16
  194. package/src/lib/components/list-paginator/list-paginator.component.scss +0 -46
  195. package/src/lib/components/list-paginator/list-paginator.component.spec.ts +0 -248
  196. package/src/lib/components/list-paginator/list-paginator.component.ts +0 -81
  197. package/src/lib/components/misc/loading-error/loading-error.component.html +0 -11
  198. package/src/lib/components/misc/loading-error/loading-error.component.scss +0 -0
  199. package/src/lib/components/misc/loading-error/loading-error.component.spec.ts +0 -75
  200. package/src/lib/components/misc/loading-error/loading-error.component.ts +0 -18
  201. package/src/lib/components/misc/loading-spinner-indicator/loading-spinner-indicator.component.html +0 -3
  202. package/src/lib/components/misc/loading-spinner-indicator/loading-spinner-indicator.component.scss +0 -0
  203. package/src/lib/components/misc/loading-spinner-indicator/loading-spinner-indicator.component.spec.ts +0 -43
  204. package/src/lib/components/misc/loading-spinner-indicator/loading-spinner-indicator.component.ts +0 -16
  205. package/src/lib/components/misc/snack-bar/snack-bar.component.html +0 -16
  206. package/src/lib/components/misc/snack-bar/snack-bar.component.scss +0 -84
  207. package/src/lib/components/misc/snack-bar/snack-bar.component.spec.ts +0 -136
  208. package/src/lib/components/misc/snack-bar/snack-bar.component.ts +0 -39
  209. package/src/lib/components/notifications/saving-confirmed-box/saving-confirmed-box.component.html +0 -11
  210. package/src/lib/components/notifications/saving-confirmed-box/saving-confirmed-box.component.scss +0 -0
  211. package/src/lib/components/notifications/saving-confirmed-box/saving-confirmed-box.component.spec.ts +0 -67
  212. package/src/lib/components/notifications/saving-confirmed-box/saving-confirmed-box.component.ts +0 -15
  213. package/src/lib/components/notifications/saving-error-box/saving-error-box.component.html +0 -11
  214. package/src/lib/components/notifications/saving-error-box/saving-error-box.component.scss +0 -0
  215. package/src/lib/components/notifications/saving-error-box/saving-error-box.component.spec.ts +0 -77
  216. package/src/lib/components/notifications/saving-error-box/saving-error-box.component.ts +0 -17
  217. package/src/lib/components/presenters/badge/badge.component.html +0 -6
  218. package/src/lib/components/presenters/badge/badge.component.scss +0 -10
  219. package/src/lib/components/presenters/badge/badge.component.spec.ts +0 -41
  220. package/src/lib/components/presenters/badge/badge.component.ts +0 -18
  221. package/src/lib/components/presenters/icon/icon.component.scss +0 -9
  222. package/src/lib/components/presenters/icon/icon.component.spec.ts +0 -38
  223. package/src/lib/components/presenters/icon/icon.component.ts +0 -37
  224. package/src/lib/core/breadcrumb.service.spec.ts +0 -35
  225. package/src/lib/core/breadcrumb.service.ts +0 -24
  226. package/src/lib/core/directives/auto-trim-and-lower.directive.spec.ts +0 -22
  227. package/src/lib/core/directives/auto-trim-and-lower.directive.ts +0 -19
  228. package/src/lib/core/directives/form-error/form-error.module.ts +0 -21
  229. package/src/lib/core/directives/form-error/has-error-root.directive.ts +0 -29
  230. package/src/lib/core/directives/form-error/has-error.directive.ts +0 -95
  231. package/src/lib/core/loading-state.service.spec.ts +0 -57
  232. package/src/lib/core/loading-state.service.ts +0 -44
  233. package/src/lib/core/models/breadcrumb-location.ts +0 -6
  234. package/src/lib/core/models/password-validation.ts +0 -20
  235. package/src/lib/core/validators/password/password-validator.spec.ts +0 -155
  236. package/src/lib/core/validators/password/password-validator.ts +0 -30
  237. package/src/lib/provide-cauca-material.ts +0 -10
  238. package/src/public-api.ts +0 -74
  239. package/src/test.ts +0 -17
  240. package/tsconfig.lib.json +0 -22
  241. package/tsconfig.lib.prod.json +0 -4
  242. package/tsconfig.spec.json +0 -17
  243. /package/{src/assets → assets}/i18n/cauca/en-material.json +0 -0
  244. /package/{src/assets → assets}/i18n/cauca/es-material.json +0 -0
  245. /package/{src/assets → assets}/i18n/cauca/fr-material.json +0 -0
  246. /package/{src/assets → assets}/images/loading.gif +0 -0
@@ -1,141 +0,0 @@
1
- import { ComponentFixture, TestBed } from '@angular/core/testing';
2
-
3
- import { PasswordInputComponent } from './password-input.component';
4
- import { MockComponent, MockModule, MockPipe } from 'ng-mocks';
5
- import { TranslateModule, TranslatePipe } from '@ngx-translate/core';
6
- import { By } from '@angular/platform-browser';
7
- import { MatIcon } from '@angular/material/icon';
8
-
9
- describe('PasswordInputComponent', () => {
10
- let component: PasswordInputComponent;
11
- let fixture: ComponentFixture<PasswordInputComponent>;
12
-
13
- beforeEach(async () => {
14
- await TestBed.configureTestingModule({
15
- imports: [PasswordInputComponent,
16
- MockModule(TranslateModule),
17
- MockComponent(MatIcon)
18
- ],
19
- declarations: [
20
- MockPipe(TranslatePipe, value => `${value}:translated`)
21
- ]
22
- })
23
- .compileComponents();
24
-
25
- fixture = TestBed.createComponent(PasswordInputComponent);
26
- component = fixture.componentInstance;
27
- fixture.detectChanges();
28
- });
29
-
30
- it('should create', () => {
31
- expect(component).toBeTruthy();
32
- });
33
-
34
- it('should update the value when writeValue is called', () => {
35
- const value = 'test123';
36
-
37
- component.writeValue(value);
38
-
39
- expect(component.passwordControl.value).toEqual(value);
40
- });
41
-
42
- it('should call onChange when passwordControl value changes', () => {
43
- const value = 'test123';
44
- const spy = spyOn(component, 'onChange');
45
-
46
- component.passwordControl.setValue(value);
47
-
48
- expect(spy).toHaveBeenCalledWith(value);
49
- });
50
-
51
- it('should disable passwordControl when setDisabledState is called with true', () => {
52
- component.setDisabledState(true);
53
- expect(component.passwordControl.disabled).toBeTrue();
54
- });
55
-
56
- it('should enable passwordControl when setDisabledState is called with false', () => {
57
- component.setDisabledState(false);
58
- expect(component.passwordControl.enabled).toBeTrue();
59
- });
60
-
61
- it('should translate label when translateLabel is true', () => {
62
- fixture.componentRef.setInput('translateLabel', true);
63
- fixture.componentRef.setInput('label', 'PASSWORD');
64
- fixture.detectChanges();
65
-
66
- const label = fixture.debugElement.query(By.css('mat-label')).nativeElement;
67
- expect(label.textContent).toBe('PASSWORD:translated');
68
- });
69
-
70
- it('should not translate label when translateLabel is false', () => {
71
- fixture.componentRef.setInput('translateLabel', false);
72
- fixture.componentRef.setInput('label', 'PASSWORD');
73
- fixture.detectChanges();
74
-
75
- const label = fixture.debugElement.query(By.css('mat-label')).nativeElement;
76
- expect(label.textContent).toBe('PASSWORD');
77
- });
78
-
79
- it('should translate placeholder when translatePlaceholder is true', () => {
80
- fixture.componentRef.setInput('translatePlaceholder', true);
81
- fixture.componentRef.setInput('placeholder', 'placeholder');
82
- fixture.detectChanges();
83
-
84
- const input = fixture.debugElement.query(By.css('input')).nativeElement;
85
- expect(input.placeholder).toBe('placeholder:translated');
86
- });
87
-
88
- it('should not translate placeholder when translatePlaceholder is false', () => {
89
- fixture.componentRef.setInput('translatePlaceholder', false);
90
- fixture.componentRef.setInput('placeholder', 'placeholder');
91
- fixture.detectChanges();
92
-
93
- const input = fixture.debugElement.query(By.css('input')).nativeElement;
94
-
95
- expect(input.placeholder).toBe('placeholder');
96
- });
97
-
98
- it('should toggle password visibility', () => {
99
- const icon = fixture.debugElement.query(By.css('mat-icon')).nativeElement;
100
-
101
- icon.click();
102
- fixture.detectChanges();
103
-
104
- expect(fixture.debugElement.query(By.css('mat-icon')).nativeElement.textContent.trim()).toBe('visibility');
105
- expect(component.showPassword()).toBeTrue();
106
- expect(component.inputType()).toBe('text');
107
-
108
- icon.click();
109
- fixture.detectChanges();
110
-
111
- expect(fixture.debugElement.query(By.css('mat-icon')).nativeElement.textContent.trim()).toBe('visibility_off');
112
- expect(component.showPassword()).toBeFalse();
113
- expect(component.inputType()).toBe('password');
114
- });
115
-
116
- it('should emit enterKeyDown when enter key is pressed', () => {
117
- const spy = spyOn(component.enterKeyDown, 'emit');
118
- const input = fixture.debugElement.query(By.css('input')).nativeElement;
119
-
120
- input.dispatchEvent(new KeyboardEvent('keydown', { key: 'Enter' }));
121
- fixture.detectChanges();
122
-
123
- expect(spy).toHaveBeenCalled();
124
- });
125
-
126
- it('should set required', () => {
127
- fixture.componentRef.setInput('required', true);
128
- fixture.detectChanges();
129
-
130
- const input = fixture.debugElement.query(By.css('input')).nativeElement;
131
- expect(input.required).toBeTrue();
132
- });
133
-
134
- it('should set autocomplete', () => {
135
- fixture.componentRef.setInput('autocomplete', 'new-password');
136
- fixture.detectChanges();
137
-
138
- const input = fixture.debugElement.query(By.css('input')).nativeElement;
139
- expect(input.autocomplete).toBe('new-password');
140
- });
141
- });
@@ -1,67 +0,0 @@
1
- import { NgClass } from '@angular/common';
2
- import { Component, computed, forwardRef, input, InputSignal, output, signal, WritableSignal } from '@angular/core';
3
- import { ControlValueAccessor, FormControl, NG_VALUE_ACCESSOR, ReactiveFormsModule } from '@angular/forms';
4
- import { MatFormFieldModule } from '@angular/material/form-field';
5
- import { MatIconModule } from '@angular/material/icon';
6
- import { MatInputModule } from '@angular/material/input';
7
- import { TranslateModule } from '@ngx-translate/core';
8
-
9
- @Component({
10
- selector: 'cauca-password-input',
11
- standalone: true,
12
- imports: [TranslateModule, NgClass, MatFormFieldModule, MatIconModule, MatInputModule, ReactiveFormsModule],
13
- templateUrl: './password-input.component.html',
14
- styleUrl: './password-input.component.scss',
15
- providers: [
16
- {
17
- provide: NG_VALUE_ACCESSOR,
18
- multi: true,
19
- useExisting: forwardRef(() => PasswordInputComponent),
20
- },
21
- ],
22
- })
23
- export class PasswordInputComponent implements ControlValueAccessor {
24
- public autocomplete: InputSignal<string> = input<'password' | 'new-password'>('password');
25
- public translateLabel: InputSignal<boolean> = input(true);
26
- public label: InputSignal<string> = input();
27
- public translatePlaceholder: InputSignal<boolean> = input(true);
28
- public placeholder: InputSignal<string> = input();
29
- public required: InputSignal<boolean> = input(false);
30
- public enterKeyDown = output();
31
-
32
- public passwordControl: FormControl = new FormControl('');
33
- public disabled: WritableSignal<boolean> = signal(false);
34
- public showPassword: WritableSignal<boolean> = signal(false);
35
- public inputType = computed(() => this.showPassword() ? 'text' : 'password');
36
-
37
- public constructor() {
38
- this.passwordControl.valueChanges.subscribe(value => {
39
- this.onChange(value);
40
- });
41
- }
42
-
43
- public writeValue(value: string): void {
44
- this.passwordControl.setValue(value);
45
- }
46
-
47
- public registerOnChange(fn: any): void {
48
- this.onChange = fn;
49
- }
50
-
51
- public registerOnTouched(fn: any): void {
52
- this.onTouched = fn;
53
- }
54
-
55
- public setDisabledState?(isDisabled: boolean): void {
56
- this.disabled.set(isDisabled);
57
- if (isDisabled) {
58
- this.passwordControl.disable();
59
- } else {
60
- this.passwordControl.enable();
61
- }
62
- }
63
-
64
- public onChange = (value: string): string => value;
65
-
66
- public onTouched = (): void => {/* This method needs to be empty */ };
67
- }
@@ -1,15 +0,0 @@
1
- <form [formGroup]="form" [class.full-width-form]="direction === 'column'">
2
- <div class="passwords">
3
- <cauca-password-input [autocomplete]="'new-password'" [label]="passwordLabel()" [translateLabel]="true" [required]="true" formControlName="password" />
4
- <cauca-password-input [autocomplete]="'new-password'" [label]="passwordConfirmationLabel()" [translateLabel]="true" [required]="true" formControlName="confirmation" />
5
- </div>
6
- <div class="errors">
7
- <ng-content></ng-content>
8
- </div>
9
- </form>
10
-
11
- @if (showCriteria()) {
12
- <cauca-password-criteria-viewer [disabled]="disabled" [passwordValidation]="passwordValidation" />
13
- } @else {
14
- <span></span>
15
- }
@@ -1,32 +0,0 @@
1
- :host {
2
- display: flex;
3
- gap: 20px;
4
- }
5
-
6
- form {
7
- width: 50%;
8
- display: flex;
9
- flex-direction: column;
10
- }
11
-
12
- .full-width-form {
13
- width: 100%;
14
- }
15
-
16
- .passwords {
17
- gap: 16px;
18
- display: flex;
19
- flex-direction: column;
20
- }
21
-
22
- .criteria {
23
- flex-grow: 1;
24
- }
25
-
26
- .disabled {
27
- opacity: 0.5;
28
- }
29
-
30
- .errors {
31
- padding: 0 16px;
32
- }
@@ -1,138 +0,0 @@
1
- import { ComponentFixture, TestBed } from '@angular/core/testing';
2
-
3
- import { PasswordSelectionComponent } from './password-selection.component';
4
- import { MockComponents, MockDirective, MockModule, ngMocks } from 'ng-mocks';
5
- import { TranslateDirective, TranslateModule } from '@ngx-translate/core';
6
- import { PasswordCriteriaViewerComponent } from '../password-criteria-viewer/password-criteria-viewer.component';
7
- import { PasswordInputComponent } from '../password-input/password-input.component';
8
-
9
- describe('PasswordSelectionComponent', () => {
10
- let component: PasswordSelectionComponent;
11
- let fixture: ComponentFixture<PasswordSelectionComponent>;
12
-
13
- beforeEach(async () => {
14
- await TestBed.configureTestingModule({
15
- imports: [PasswordSelectionComponent,
16
- MockModule(TranslateModule),
17
- ...MockComponents(PasswordCriteriaViewerComponent, PasswordInputComponent),
18
- ],
19
- declarations: [
20
- MockDirective(TranslateDirective)
21
- ]
22
- })
23
- .compileComponents();
24
-
25
- fixture = TestBed.createComponent(PasswordSelectionComponent);
26
- component = fixture.componentInstance;
27
- fixture.detectChanges();
28
- });
29
-
30
- it('should create', () => {
31
- expect(component).toBeTruthy();
32
- });
33
-
34
- it('should validate password when form change', () => {
35
- const somePasswordWithNumeric = '4321';
36
- const somePasswordWithNumericAndSpecialCharacter = '4321#';
37
-
38
- component.form.get('password').setValue(somePasswordWithNumeric);
39
-
40
- expect(component.passwordValidation.hasMinimumNumeric).toBeTrue();
41
- expect(component.passwordValidation.hasSpecialCharacter).toBeFalse();
42
-
43
- component.form.get('password').setValue(somePasswordWithNumericAndSpecialCharacter);
44
-
45
- expect(component.passwordValidation.hasMinimumNumeric).toBeTrue();
46
- expect(component.passwordValidation.hasSpecialCharacter).toBeTrue();
47
- });
48
-
49
- it('should only emit full password when form is valid', () => {
50
- const spy = spyOn(component, 'onChange');
51
- const somePassword = 'CaucaTest4321#';
52
-
53
- component.form.get('password').setValue(somePassword);
54
- component.form.get('confirmation').setValue(somePassword);
55
- fixture.detectChanges();
56
-
57
- expect(spy).toHaveBeenCalledOnceWith(somePassword);
58
- });
59
-
60
- it('should emit empty password when form validity change to to invalid', async () => {
61
- const spy = spyOn(component, 'onChange');
62
- const somePassword = 'CaucaTest4321#';
63
- component.form.get('password').setValue(somePassword);
64
- component.form.get('confirmation').setValue(somePassword);
65
-
66
- expect(spy).toHaveBeenCalledOnceWith(somePassword);
67
-
68
- const password = component.form.get('password');
69
- await password.setValue('C');
70
- await password.setValue('Ca');
71
- await password.setValue('Cau');
72
- await password.setValue('Cauc');
73
- fixture.detectChanges();
74
-
75
- expect(spy).toHaveBeenCalledTimes(2);
76
- expect(spy).toHaveBeenCalledWith('');
77
- });
78
-
79
- it('should disable input when disable is set', () => {
80
- const password = component.form.get('password');
81
- const confirmation = component.form.get('confirmation');
82
-
83
- component.setDisabledState(true);
84
- fixture.detectChanges();
85
-
86
- expect(password.disabled).toBeTrue();
87
- expect(confirmation.disabled).toBeTrue();
88
- });
89
-
90
- it('should not show criteria when password has no value', () => {
91
- fixture.componentRef.setInput('showCriteriaOnlyWhenPasswordHasValue', true);
92
- fixture.componentRef.setInput('alwaysShowCriteria', false);
93
- component.form.get('password').setValue('');
94
- component.form.get('confirmation').setValue('');
95
- fixture.detectChanges();
96
-
97
- expect(component.showCriteria()).toBeFalse();
98
- expect(ngMocks.find('cauca-password-criteria-viewer', null)).toBeNull();
99
- });
100
-
101
- it('should show criteria when password has value', () => {
102
- fixture.componentRef.setInput('showCriteriaOnlyWhenPasswordHasValue', true);
103
-
104
- component.form.get('password').setValue('CaucaTest4321#');
105
- component.form.get('confirmation').setValue('CaucaTest4321#');
106
- fixture.detectChanges();
107
-
108
- expect(component.showCriteria()).toBeTrue();
109
- expect(ngMocks.find('cauca-password-criteria-viewer', null)).not.toBeNull();
110
- });
111
-
112
- it('should show criteria when alwaysShowCriteria is set to true', () => {
113
- fixture.componentRef.setInput('showCriteriaOnlyWhenPasswordHasValue', true);
114
- fixture.componentRef.setInput('alwaysShowCriteria', true);
115
- component.form.get('password').setValue('');
116
- component.form.get('confirmation').setValue('');
117
- fixture.detectChanges();
118
-
119
- expect(component.showCriteria()).toBeTrue();
120
- expect(ngMocks.find('cauca-password-criteria-viewer', null)).not.toBeNull();
121
- });
122
-
123
- it('should set password label from input', () => {
124
- const passwordLabel = 'newPassword';
125
- fixture.componentRef.setInput('passwordLabel', passwordLabel);
126
- fixture.detectChanges();
127
-
128
- expect(component.passwordLabel()).toBe(passwordLabel);
129
- });
130
-
131
- it('should set password confirmation from input', () => {
132
- const passwordConfirmationLabel = 'confirmPassword';
133
- fixture.componentRef.setInput('passwordConfirmationLabel', passwordConfirmationLabel);
134
- fixture.detectChanges();
135
-
136
- expect(component.passwordConfirmationLabel()).toBe(passwordConfirmationLabel);
137
- });
138
- });
@@ -1,100 +0,0 @@
1
- import { Component, forwardRef, HostBinding, input, Input, output, signal } from '@angular/core';
2
- import { TranslateModule } from '@ngx-translate/core';
3
- import { PasswordCriteriaViewerComponent } from '../password-criteria-viewer/password-criteria-viewer.component';
4
- import { ControlValueAccessor, FormsModule, NG_VALUE_ACCESSOR, ReactiveFormsModule, UntypedFormBuilder, UntypedFormGroup, ValidationErrors, Validators } from '@angular/forms';
5
- import { filter } from 'rxjs';
6
- import { PasswordInputComponent } from '../password-input/password-input.component';
7
- import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
8
- import { PasswordValidation } from '../../../../core/models/password-validation';
9
- import { PasswordValidator } from '../../../../core/validators/password/password-validator';
10
-
11
-
12
- @Component({
13
- selector: 'cauca-password-selection',
14
- standalone: true,
15
- imports: [PasswordInputComponent, FormsModule, ReactiveFormsModule, TranslateModule, PasswordCriteriaViewerComponent],
16
- templateUrl: './password-selection.component.html',
17
- styleUrl: './password-selection.component.scss',
18
- providers: [
19
- {
20
- provide: NG_VALUE_ACCESSOR,
21
- multi: true,
22
- useExisting: forwardRef(() => PasswordSelectionComponent),
23
- },
24
- ],
25
- })
26
- export class PasswordSelectionComponent implements ControlValueAccessor {
27
- public form: UntypedFormGroup;
28
- public passwordValidation: PasswordValidation = new PasswordValidation();
29
- public disabled: boolean = false;
30
-
31
- @Input() @HostBinding('style.flex-direction') public direction: 'row'|'column' = 'row';
32
- @Input() @HostBinding('style.form.width') public formWidth: string = '50%';
33
- public showCriteriaOnlyWhenPasswordHasValue = input<boolean>(true);
34
- public alwaysShowCriteria = input<boolean>(true);
35
- public showCriteria = signal<boolean>(true);
36
- public passwordLabel = input<string>('passwordEdition.password');
37
- public passwordConfirmationLabel = input<string>('passwordEdition.passwordConfirmation');
38
- public hasValueChange = output<boolean>();
39
-
40
- private lastPasswordValidationSent = false;
41
-
42
- public constructor(formBuilder: UntypedFormBuilder) {
43
- this.form = formBuilder.group({
44
- password: ['', Validators.required],
45
- confirmation: ['', Validators.required]
46
- }, { validators: (formGroup: UntypedFormGroup): ValidationErrors | null => {
47
- this.passwordValidation = PasswordValidator.validate(formGroup);
48
- if (!this.passwordValidation.isValid()) {
49
- return ({ validation: this.passwordValidation});
50
- }
51
- return null;
52
- }});
53
- this.form.valueChanges.pipe(takeUntilDestroyed())
54
- .subscribe(() => {
55
- if (!this.alwaysShowCriteria()) {
56
- if (this.showCriteriaOnlyWhenPasswordHasValue()) {
57
- this.showCriteria.set(this.form.controls.password.value?.length > 0 || this.form.controls.confirmation.value?.length > 0);
58
- }
59
- }
60
- this.hasValueChange.emit(this.form.controls.password.value?.length > 0);
61
- });
62
- this.form.valueChanges.pipe(takeUntilDestroyed(), filter(_ => this.form.valid != this.lastPasswordValidationSent)).subscribe(form => {
63
- this.lastPasswordValidationSent = this.form.valid;
64
- if (this.form.valid) {
65
- this.onChange(form.password);
66
- } else {
67
- this.onChange('');
68
- }
69
- });
70
- }
71
-
72
- public writeValue(value: string): void {
73
- this.form.get('password').setValue(value);
74
- this.form.get('confirmation').setValue(value);
75
- }
76
-
77
- public registerOnChange(fn: any): void {
78
- this.onChange = fn;
79
- }
80
-
81
- public registerOnTouched(fn: any): void {
82
- this.onTouched = fn;
83
- }
84
-
85
- public setDisabledState?(isDisabled: boolean): void {
86
- this.disabled = isDisabled;
87
- if (isDisabled) {
88
- this.form.get('password').disable();
89
- this.form.get('confirmation').disable();
90
- } else {
91
- this.form.get('password').enable();
92
- this.form.get('confirmation').enable();
93
- }
94
- }
95
-
96
- public onChange = (value: string): string => value;
97
-
98
- public onTouched = (): void => {/* This method needs to be empty */ };
99
-
100
- }
@@ -1,19 +0,0 @@
1
- <mat-form-field class="full-width-field header dense" subscriptSizing="dynamic">
2
- <ng-content></ng-content>
3
- <mat-label>{{ label | translate }}</mat-label>
4
- <mat-select [(value)]="value" [disabled]="disableControl()" [class.readonly-field]="disableControl()" [multiple]="allowMultiSelection()" >
5
- @if (enableSearch()) {
6
- <mat-option>
7
- <ngx-mat-select-search [formControl]="optionFilterControl" [placeholderLabel]="'search' | translate"
8
- [noEntriesFoundLabel]="'noResult' | translate">
9
- </ngx-mat-select-search>
10
- </mat-option>
11
- }
12
- @for (option of filteredOptions.value() || []; track option) {
13
- <mat-option [value]="option.id">
14
- {{option.name}}
15
- </mat-option>
16
- }
17
- </mat-select>
18
-
19
- </mat-form-field>