@cauca-911/material 21.0.1-beta.4 → 21.0.1-beta.5

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 (238) hide show
  1. package/.eslintrc.json +79 -0
  2. package/README_PACKAGE.md +5 -0
  3. package/karma.conf.js +50 -0
  4. package/ng-package.json +7 -0
  5. package/package.json +2 -17
  6. package/src/assets/i18n/cauca/en-material.json +104 -0
  7. package/src/assets/i18n/cauca/es-material.json +104 -0
  8. package/src/assets/i18n/cauca/fr-material.json +106 -0
  9. package/src/assets/images/loading.gif +0 -0
  10. package/src/lib/cauca-material.component.html +1 -0
  11. package/src/lib/cauca-material.component.spec.ts +29 -0
  12. package/src/lib/cauca-material.component.ts +12 -0
  13. package/src/lib/cauca-material.service.spec.ts +16 -0
  14. package/src/lib/cauca-material.service.ts +7 -0
  15. package/src/lib/components/button/button.component.html +52 -0
  16. package/src/lib/components/button/button.component.scss +6 -0
  17. package/src/lib/components/button/button.component.spec.ts +142 -0
  18. package/src/lib/components/button/button.component.ts +22 -0
  19. package/src/lib/components/buttons/base-button.ts +35 -0
  20. package/src/lib/components/buttons/basic-button/basic-button.component.html +5 -0
  21. package/src/lib/components/buttons/basic-button/basic-button.component.scss +12 -0
  22. package/src/lib/components/buttons/basic-button/basic-button.component.spec.ts +106 -0
  23. package/src/lib/components/buttons/basic-button/basic-button.component.ts +17 -0
  24. package/src/lib/components/buttons/fab-button/fab-button.component.html +3 -0
  25. package/src/lib/components/buttons/fab-button/fab-button.component.scss +12 -0
  26. package/src/lib/components/buttons/fab-button/fab-button.component.spec.ts +82 -0
  27. package/src/lib/components/buttons/fab-button/fab-button.component.ts +16 -0
  28. package/src/lib/components/buttons/flat-button/flat-button.component.html +5 -0
  29. package/src/lib/components/buttons/flat-button/flat-button.component.scss +12 -0
  30. package/src/lib/components/buttons/flat-button/flat-button.component.spec.ts +106 -0
  31. package/src/lib/components/buttons/flat-button/flat-button.component.ts +17 -0
  32. package/src/lib/components/buttons/icon-button/icon-button.component.html +3 -0
  33. package/src/lib/components/buttons/icon-button/icon-button.component.scss +23 -0
  34. package/src/lib/components/buttons/icon-button/icon-button.component.spec.ts +38 -0
  35. package/src/lib/components/buttons/icon-button/icon-button.component.ts +15 -0
  36. package/src/lib/components/buttons/link-button/link-button.component.html +1 -0
  37. package/src/lib/components/buttons/link-button/link-button.component.scss +3 -0
  38. package/src/lib/components/buttons/link-button/link-button.component.spec.ts +97 -0
  39. package/src/lib/components/buttons/link-button/link-button.component.ts +25 -0
  40. package/src/lib/components/buttons/menu-item/menu-item.component.html +5 -0
  41. package/src/lib/components/buttons/menu-item/menu-item.component.scss +6 -0
  42. package/src/lib/components/buttons/menu-item/menu-item.component.spec.ts +66 -0
  43. package/src/lib/components/buttons/menu-item/menu-item.component.ts +19 -0
  44. package/src/lib/components/buttons/raised-button/raised-button.component.html +5 -0
  45. package/src/lib/components/buttons/raised-button/raised-button.component.scss +12 -0
  46. package/src/lib/components/buttons/raised-button/raised-button.component.spec.ts +108 -0
  47. package/src/lib/components/buttons/raised-button/raised-button.component.ts +17 -0
  48. package/src/lib/components/buttons/refresh-button/refresh-button.component.html +1 -0
  49. package/src/lib/components/buttons/refresh-button/refresh-button.component.scss +0 -0
  50. package/src/lib/components/buttons/refresh-button/refresh-button.component.spec.ts +81 -0
  51. package/src/lib/components/buttons/refresh-button/refresh-button.component.ts +19 -0
  52. package/src/lib/components/buttons/round-button/round-button.component.html +3 -0
  53. package/src/lib/components/buttons/round-button/round-button.component.scss +34 -0
  54. package/src/lib/components/buttons/round-button/round-button.component.spec.ts +26 -0
  55. package/src/lib/components/buttons/round-button/round-button.component.ts +14 -0
  56. package/src/lib/components/buttons/stroked-button/stroked-button.component.html +5 -0
  57. package/src/lib/components/buttons/stroked-button/stroked-button.component.scss +23 -0
  58. package/src/lib/components/buttons/stroked-button/stroked-button.component.spec.ts +114 -0
  59. package/src/lib/components/buttons/stroked-button/stroked-button.component.ts +17 -0
  60. package/src/lib/components/cauca-date-time-picker/cauca-date-time-picker.component.html +9 -0
  61. package/src/lib/components/cauca-date-time-picker/cauca-date-time-picker.component.scss +7 -0
  62. package/src/lib/components/cauca-date-time-picker/cauca-date-time-picker.component.spec.ts +68 -0
  63. package/src/lib/components/cauca-date-time-picker/cauca-date-time-picker.component.ts +155 -0
  64. package/src/lib/components/cauca-date-time-picker/components/desktop-time-picker/desktop-time-picker.component.html +6 -0
  65. package/src/lib/components/cauca-date-time-picker/components/desktop-time-picker/desktop-time-picker.component.scss +25 -0
  66. package/src/lib/components/cauca-date-time-picker/components/desktop-time-picker/desktop-time-picker.component.spec.ts +23 -0
  67. package/src/lib/components/cauca-date-time-picker/components/desktop-time-picker/desktop-time-picker.component.ts +23 -0
  68. package/src/lib/components/cauca-date-time-picker/components/dialog-date-time-picker/dialog-date-time-picker.component.html +77 -0
  69. package/src/lib/components/cauca-date-time-picker/components/dialog-date-time-picker/dialog-date-time-picker.component.scss +124 -0
  70. package/src/lib/components/cauca-date-time-picker/components/dialog-date-time-picker/dialog-date-time-picker.component.spec.ts +96 -0
  71. package/src/lib/components/cauca-date-time-picker/components/dialog-date-time-picker/dialog-date-time-picker.component.ts +228 -0
  72. package/src/lib/components/cauca-date-time-picker/components/mobile-time-picker/mobile-time-picker.component.html +9 -0
  73. package/src/lib/components/cauca-date-time-picker/components/mobile-time-picker/mobile-time-picker.component.scss +15 -0
  74. package/src/lib/components/cauca-date-time-picker/components/mobile-time-picker/mobile-time-picker.component.spec.ts +105 -0
  75. package/src/lib/components/cauca-date-time-picker/components/mobile-time-picker/mobile-time-picker.component.ts +48 -0
  76. package/src/lib/components/cauca-date-time-picker/models/dialog-date-time-picker-data.ts +29 -0
  77. package/src/lib/components/deprecated-components/cauca-input-file/cauca-input-file.component.html +14 -0
  78. package/src/lib/components/deprecated-components/cauca-input-file/cauca-input-file.component.scss +3 -0
  79. package/src/lib/components/deprecated-components/cauca-input-file/cauca-input-file.component.ts +87 -0
  80. package/src/lib/components/deprecated-components/cauca-input-multiple-langue/cauca-input-multiple-langue.component.html +12 -0
  81. package/src/lib/components/deprecated-components/cauca-input-multiple-langue/cauca-input-multiple-langue.component.scss +3 -0
  82. package/src/lib/components/deprecated-components/cauca-input-multiple-langue/cauca-input-multiple-langue.component.spec.ts +35 -0
  83. package/src/lib/components/deprecated-components/cauca-input-multiple-langue/cauca-input-multiple-langue.component.ts +57 -0
  84. package/src/lib/components/deprecated-components/cauca-menu-vertical/cauca-menu-vertical.component.html +49 -0
  85. package/src/lib/components/deprecated-components/cauca-menu-vertical/cauca-menu-vertical.component.ts +56 -0
  86. package/src/lib/components/deprecated-components/cauca-simple-dialog/cauca-simple-dialog.component.html +11 -0
  87. package/src/lib/components/deprecated-components/cauca-simple-dialog/cauca-simple-dialog.component.scss +4 -0
  88. package/src/lib/components/deprecated-components/cauca-simple-dialog/cauca-simple-dialog.component.spec.ts +39 -0
  89. package/src/lib/components/deprecated-components/cauca-simple-dialog/cauca-simple-dialog.component.ts +20 -0
  90. package/src/lib/components/deprecated-components/cauca-slideshow/cauca-slideshow.component.html +7 -0
  91. package/src/lib/components/deprecated-components/cauca-slideshow/cauca-slideshow.component.scss +41 -0
  92. package/src/lib/components/deprecated-components/cauca-slideshow/cauca-slideshow.component.spec.ts +24 -0
  93. package/src/lib/components/deprecated-components/cauca-slideshow/cauca-slideshow.component.ts +67 -0
  94. package/src/lib/components/deprecated-components/shared/models/menu-item.ts +11 -0
  95. package/src/lib/components/deprecated-components/shared/models/simple-dialog-data.ts +5 -0
  96. package/src/lib/components/dialogs/alert-dialog/alert-dialog.component.html +10 -0
  97. package/src/lib/components/dialogs/alert-dialog/alert-dialog.component.scss +14 -0
  98. package/src/lib/components/dialogs/alert-dialog/alert-dialog.component.spec.ts +90 -0
  99. package/src/lib/components/dialogs/alert-dialog/alert-dialog.component.ts +41 -0
  100. package/src/lib/components/dialogs/confirm-dialog/confirm-dialog.component.html +11 -0
  101. package/src/lib/components/dialogs/confirm-dialog/confirm-dialog.component.scss +29 -0
  102. package/src/lib/components/dialogs/confirm-dialog/confirm-dialog.component.spec.ts +137 -0
  103. package/src/lib/components/dialogs/confirm-dialog/confirm-dialog.component.ts +47 -0
  104. package/src/lib/components/dialogs/delete-dialog/delete-dialog.component.html +17 -0
  105. package/src/lib/components/dialogs/delete-dialog/delete-dialog.component.scss +14 -0
  106. package/src/lib/components/dialogs/delete-dialog/delete-dialog.component.spec.ts +96 -0
  107. package/src/lib/components/dialogs/delete-dialog/delete-dialog.component.ts +40 -0
  108. package/src/lib/components/dialogs/delete-dialog/models/delete-dialog-data.spec.ts +7 -0
  109. package/src/lib/components/dialogs/delete-dialog/models/delete-dialog-data.ts +5 -0
  110. package/src/lib/components/dialogs/dialog-styles.css +9 -0
  111. package/src/lib/components/dialogs/dialog-styles.scss +9 -0
  112. package/src/lib/components/dialogs/error-dialog/error-dialog.component.html +10 -0
  113. package/src/lib/components/dialogs/error-dialog/error-dialog.component.scss +10 -0
  114. package/src/lib/components/dialogs/error-dialog/error-dialog.component.spec.ts +91 -0
  115. package/src/lib/components/dialogs/error-dialog/error-dialog.component.ts +32 -0
  116. package/src/lib/components/dialogs/services/dialog.service.spec.ts +82 -0
  117. package/src/lib/components/dialogs/services/dialog.service.ts +107 -0
  118. package/src/lib/components/dialogs/text-input-dialog/text-input-dialog.component.html +24 -0
  119. package/src/lib/components/dialogs/text-input-dialog/text-input-dialog.component.scss +22 -0
  120. package/src/lib/components/dialogs/text-input-dialog/text-input-dialog.component.spec.ts +126 -0
  121. package/src/lib/components/dialogs/text-input-dialog/text-input-dialog.component.ts +66 -0
  122. package/src/lib/components/inputs/color-picker/color-picker.component.html +9 -0
  123. package/src/lib/components/inputs/color-picker/color-picker.component.scss +0 -0
  124. package/src/lib/components/inputs/color-picker/color-picker.component.spec.ts +29 -0
  125. package/src/lib/components/inputs/color-picker/color-picker.component.ts +111 -0
  126. package/src/lib/components/inputs/date-range-picker/date-range-picker.component.html +13 -0
  127. package/src/lib/components/inputs/date-range-picker/date-range-picker.component.scss +0 -0
  128. package/src/lib/components/inputs/date-range-picker/date-range-picker.component.spec.ts +80 -0
  129. package/src/lib/components/inputs/date-range-picker/date-range-picker.component.ts +46 -0
  130. package/src/lib/components/inputs/dropdown-chip-autocomplete/dropdown-chip-autocomplete.component.html +40 -0
  131. package/src/lib/components/inputs/dropdown-chip-autocomplete/dropdown-chip-autocomplete.component.scss +39 -0
  132. package/src/lib/components/inputs/dropdown-chip-autocomplete/dropdown-chip-autocomplete.component.spec.ts +135 -0
  133. package/src/lib/components/inputs/dropdown-chip-autocomplete/dropdown-chip-autocomplete.component.ts +263 -0
  134. package/src/lib/components/inputs/password/password-criteria/password-criteria.component.html +6 -0
  135. package/src/lib/components/inputs/password/password-criteria/password-criteria.component.scss +27 -0
  136. package/src/lib/components/inputs/password/password-criteria/password-criteria.component.spec.ts +90 -0
  137. package/src/lib/components/inputs/password/password-criteria/password-criteria.component.ts +17 -0
  138. package/src/lib/components/inputs/password/password-criteria-viewer/password-criteria-viewer.component.html +5 -0
  139. package/src/lib/components/inputs/password/password-criteria-viewer/password-criteria-viewer.component.scss +8 -0
  140. package/src/lib/components/inputs/password/password-criteria-viewer/password-criteria-viewer.component.spec.ts +98 -0
  141. package/src/lib/components/inputs/password/password-criteria-viewer/password-criteria-viewer.component.ts +16 -0
  142. package/src/lib/components/inputs/password/password-input/password-input.component.html +11 -0
  143. package/src/lib/components/inputs/password/password-input/password-input.component.scss +12 -0
  144. package/src/lib/components/inputs/password/password-input/password-input.component.spec.ts +141 -0
  145. package/src/lib/components/inputs/password/password-input/password-input.component.ts +67 -0
  146. package/src/lib/components/inputs/password/password-selection/password-selection.component.html +15 -0
  147. package/src/lib/components/inputs/password/password-selection/password-selection.component.scss +32 -0
  148. package/src/lib/components/inputs/password/password-selection/password-selection.component.spec.ts +138 -0
  149. package/src/lib/components/inputs/password/password-selection/password-selection.component.ts +101 -0
  150. package/src/lib/components/inputs/select-with-search/select-with-search.component.html +19 -0
  151. package/src/lib/components/inputs/select-with-search/select-with-search.component.scss +0 -0
  152. package/src/lib/components/inputs/select-with-search/select-with-search.component.spec.ts +215 -0
  153. package/src/lib/components/inputs/select-with-search/select-with-search.component.ts +108 -0
  154. package/src/lib/components/layout/expandable-panel/expandable-panel.component.html +14 -0
  155. package/src/lib/components/layout/expandable-panel/expandable-panel.component.scss +48 -0
  156. package/src/lib/components/layout/expandable-panel/expandable-panel.component.spec.ts +48 -0
  157. package/src/lib/components/layout/expandable-panel/expandable-panel.component.ts +19 -0
  158. package/src/lib/components/layout/group-container/group-container.component.html +6 -0
  159. package/src/lib/components/layout/group-container/group-container.component.scss +22 -0
  160. package/src/lib/components/layout/group-container/group-container.component.spec.ts +34 -0
  161. package/src/lib/components/layout/group-container/group-container.component.ts +14 -0
  162. package/src/lib/components/layout/menu-expandable-panel/menu-expandable-panel.component.html +13 -0
  163. package/src/lib/components/layout/menu-expandable-panel/menu-expandable-panel.component.scss +27 -0
  164. package/src/lib/components/layout/menu-expandable-panel/menu-expandable-panel.component.spec.ts +144 -0
  165. package/src/lib/components/layout/menu-expandable-panel/menu-expandable-panel.component.ts +52 -0
  166. package/src/lib/components/layout/menu-expandable-panel-item/menu-expandable-panel-item.component.html +4 -0
  167. package/src/lib/components/layout/menu-expandable-panel-item/menu-expandable-panel-item.component.scss +10 -0
  168. package/src/lib/components/layout/menu-expandable-panel-item/menu-expandable-panel-item.component.spec.ts +80 -0
  169. package/src/lib/components/layout/menu-expandable-panel-item/menu-expandable-panel-item.component.ts +28 -0
  170. package/src/lib/components/layout/page-title/page-title.component.html +35 -0
  171. package/src/lib/components/layout/page-title/page-title.component.scss +40 -0
  172. package/src/lib/components/layout/page-title/page-title.component.spec.ts +162 -0
  173. package/src/lib/components/layout/page-title/page-title.component.ts +28 -0
  174. package/src/lib/components/layout/sections/main-section/main-section.component.html +6 -0
  175. package/src/lib/components/layout/sections/main-section/main-section.component.scss +27 -0
  176. package/src/lib/components/layout/sections/main-section/main-section.component.spec.ts +42 -0
  177. package/src/lib/components/layout/sections/main-section/main-section.component.ts +13 -0
  178. package/src/lib/components/layout/sections/section-column/section-column.component.html +3 -0
  179. package/src/lib/components/layout/sections/section-column/section-column.component.scss +18 -0
  180. package/src/lib/components/layout/sections/section-column/section-column.component.spec.ts +35 -0
  181. package/src/lib/components/layout/sections/section-column/section-column.component.ts +12 -0
  182. package/src/lib/components/layout/sections/section-field/section-field.component.html +21 -0
  183. package/src/lib/components/layout/sections/section-field/section-field.component.scss +44 -0
  184. package/src/lib/components/layout/sections/section-field/section-field.component.spec.ts +74 -0
  185. package/src/lib/components/layout/sections/section-field/section-field.component.ts +22 -0
  186. package/src/lib/components/list-paginator/list-paginator.component.html +16 -0
  187. package/src/lib/components/list-paginator/list-paginator.component.scss +46 -0
  188. package/src/lib/components/list-paginator/list-paginator.component.spec.ts +248 -0
  189. package/src/lib/components/list-paginator/list-paginator.component.ts +81 -0
  190. package/src/lib/components/misc/loading-error/loading-error.component.html +11 -0
  191. package/src/lib/components/misc/loading-error/loading-error.component.scss +0 -0
  192. package/src/lib/components/misc/loading-error/loading-error.component.spec.ts +75 -0
  193. package/src/lib/components/misc/loading-error/loading-error.component.ts +18 -0
  194. package/src/lib/components/misc/loading-spinner-indicator/loading-spinner-indicator.component.html +3 -0
  195. package/src/lib/components/misc/loading-spinner-indicator/loading-spinner-indicator.component.scss +0 -0
  196. package/src/lib/components/misc/loading-spinner-indicator/loading-spinner-indicator.component.spec.ts +43 -0
  197. package/src/lib/components/misc/loading-spinner-indicator/loading-spinner-indicator.component.ts +16 -0
  198. package/src/lib/components/misc/snack-bar/snack-bar.component.html +16 -0
  199. package/src/lib/components/misc/snack-bar/snack-bar.component.scss +84 -0
  200. package/src/lib/components/misc/snack-bar/snack-bar.component.spec.ts +136 -0
  201. package/src/lib/components/misc/snack-bar/snack-bar.component.ts +39 -0
  202. package/src/lib/components/notifications/saving-confirmed-box/saving-confirmed-box.component.html +11 -0
  203. package/src/lib/components/notifications/saving-confirmed-box/saving-confirmed-box.component.scss +0 -0
  204. package/src/lib/components/notifications/saving-confirmed-box/saving-confirmed-box.component.spec.ts +67 -0
  205. package/src/lib/components/notifications/saving-confirmed-box/saving-confirmed-box.component.ts +15 -0
  206. package/src/lib/components/notifications/saving-error-box/saving-error-box.component.html +11 -0
  207. package/src/lib/components/notifications/saving-error-box/saving-error-box.component.scss +0 -0
  208. package/src/lib/components/notifications/saving-error-box/saving-error-box.component.spec.ts +77 -0
  209. package/src/lib/components/notifications/saving-error-box/saving-error-box.component.ts +17 -0
  210. package/src/lib/components/presenters/badge/badge.component.html +6 -0
  211. package/src/lib/components/presenters/badge/badge.component.scss +10 -0
  212. package/src/lib/components/presenters/badge/badge.component.spec.ts +41 -0
  213. package/src/lib/components/presenters/badge/badge.component.ts +18 -0
  214. package/src/lib/components/presenters/icon/icon.component.scss +9 -0
  215. package/src/lib/components/presenters/icon/icon.component.spec.ts +38 -0
  216. package/src/lib/components/presenters/icon/icon.component.ts +37 -0
  217. package/src/lib/core/breadcrumb.service.spec.ts +35 -0
  218. package/src/lib/core/breadcrumb.service.ts +24 -0
  219. package/src/lib/core/directives/auto-trim-and-lower.directive.spec.ts +22 -0
  220. package/src/lib/core/directives/auto-trim-and-lower.directive.ts +19 -0
  221. package/src/lib/core/directives/form-error/form-error.module.ts +21 -0
  222. package/src/lib/core/directives/form-error/has-error-root.directive.ts +31 -0
  223. package/src/lib/core/directives/form-error/has-error.directive.ts +95 -0
  224. package/src/lib/core/loading-state.service.spec.ts +57 -0
  225. package/src/lib/core/loading-state.service.ts +44 -0
  226. package/src/lib/core/models/breadcrumb-location.ts +6 -0
  227. package/src/lib/core/models/password-validation.ts +20 -0
  228. package/src/lib/core/validators/password/password-validator.spec.ts +155 -0
  229. package/src/lib/core/validators/password/password-validator.ts +30 -0
  230. package/src/lib/provide-cauca-material.ts +10 -0
  231. package/src/public-api.ts +70 -0
  232. package/src/test.ts +17 -0
  233. package/tsconfig.lib.json +18 -0
  234. package/tsconfig.lib.prod.json +4 -0
  235. package/tsconfig.spec.json +17 -0
  236. package/fesm2022/cauca-911-material.mjs +0 -4323
  237. package/fesm2022/cauca-911-material.mjs.map +0 -1
  238. package/types/cauca-911-material.d.ts +0 -755
@@ -0,0 +1,142 @@
1
+ import { ComponentFixture, TestBed, fakeAsync, tick } from '@angular/core/testing';
2
+
3
+ import { ButtonComponent } from './button.component';
4
+ import { HarnessLoader } from '@angular/cdk/testing';
5
+ import { MatButtonModule } from '@angular/material/button';
6
+ import { MatIconModule } from '@angular/material/icon';
7
+ import { TestbedHarnessEnvironment } from '@angular/cdk/testing/testbed';
8
+ import { MatButtonHarness } from '@angular/material/button/testing';
9
+ import { MatIconHarness } from '@angular/material/icon/testing';
10
+
11
+ describe('ButtonWithProgressComponent', () => {
12
+ let component: ButtonComponent;
13
+ let fixture: ComponentFixture<ButtonComponent>;
14
+ let loader: HarnessLoader;
15
+
16
+ beforeEach(async () => {
17
+ await TestBed.configureTestingModule({
18
+ imports: [
19
+ MatButtonModule,
20
+ MatIconModule
21
+ ]
22
+ })
23
+ .compileComponents();
24
+
25
+ fixture = TestBed.createComponent(ButtonComponent);
26
+ loader = TestbedHarnessEnvironment.loader(fixture);
27
+ component = fixture.componentInstance;
28
+ fixture.detectChanges();
29
+ });
30
+
31
+ it('should create', () => {
32
+ expect(component).toBeTruthy();
33
+ });
34
+
35
+ it('should mat-icon-button when type is icon', async () => {
36
+
37
+ fixture.componentRef.setInput('type', 'icon');
38
+ fixture.detectChanges();
39
+
40
+ const button = await loader.getHarnessOrNull(MatButtonHarness);
41
+ expect(await button.getVariant()).toBe('icon');
42
+ });
43
+
44
+ it('should mat-flat-button when type is flat', async () => {
45
+
46
+ fixture.componentRef.setInput('type', 'flat');
47
+ fixture.detectChanges();
48
+
49
+ const button = await loader.getHarnessOrNull(MatButtonHarness);
50
+ expect(await button.getAppearance()).toBe('filled');
51
+ });
52
+
53
+ it('should mat-raised-button when type is raised', async () => {
54
+
55
+ fixture.componentRef.setInput('type', 'raised');
56
+ fixture.detectChanges();
57
+
58
+ const button = await loader.getHarnessOrNull(MatButtonHarness);
59
+ expect(await button.getAppearance()).toBe('elevated');
60
+ });
61
+
62
+ it('should mat-stroked-button when type is stroked', async () => {
63
+
64
+ fixture.componentRef.setInput('type', 'stroked');
65
+
66
+ fixture.detectChanges();
67
+
68
+ const button = await loader.getHarnessOrNull(MatButtonHarness);
69
+ expect(await button.getAppearance()).toBe('outlined');
70
+ });
71
+
72
+ it('should mat-basic-button when type is basic', async () => {
73
+
74
+ fixture.componentRef.setInput('type', 'basic');
75
+
76
+ const button = await loader.getHarnessOrNull(MatButtonHarness);
77
+ expect(await button.getVariant()).toBe('basic');
78
+ });
79
+
80
+ it('should correctly display label', async () => {
81
+ const someLabel = 'someLabel';
82
+
83
+ fixture.componentRef.setInput('label', someLabel);
84
+ fixture.detectChanges();
85
+
86
+ const button = await loader.getHarnessOrNull(MatButtonHarness);
87
+ expect(await button.getText()).toBe(someLabel);
88
+ });
89
+
90
+ it('should disable button when disabled is set', async () => {
91
+ fixture.componentRef.setInput('disable', true);
92
+ fixture.detectChanges();
93
+
94
+ const button = await loader.getHarnessOrNull(MatButtonHarness);
95
+ expect(await button.isDisabled()).toBeTrue();
96
+ });
97
+
98
+ it('should enable button when disabled is not set', async () => {
99
+ fixture.componentRef.setInput('disable', false);
100
+ fixture.detectChanges();
101
+
102
+ const button = await loader.getHarnessOrNull(MatButtonHarness);
103
+ expect(await button.isDisabled()).toBeFalse();
104
+ });
105
+
106
+ it('should disable button when disabled is not set and show load icon', async () => {
107
+ fixture.componentRef.setInput('inProgress', true);
108
+ fixture.detectChanges();
109
+
110
+ const button = await loader.getHarnessOrNull(MatButtonHarness);
111
+ const icon = await button.getHarness(MatIconHarness);
112
+ expect(await button.isDisabled()).toBeTrue();
113
+ expect(await icon.getName()).toBe('update');
114
+ });
115
+
116
+ it('should show correct icon when not loading and icon is set', async () => {
117
+ fixture.componentRef.setInput('icon', 'test');
118
+ fixture.detectChanges();
119
+
120
+ const button = await loader.getHarnessOrNull(MatButtonHarness);
121
+ const icon = await button.getHarness(MatIconHarness);
122
+ expect(await icon.getName()).toBe('test');
123
+ });
124
+
125
+ it('should not show any icon when not set', async () => {
126
+ fixture.componentRef.setInput('icon', null);
127
+
128
+ const button = await loader.getHarnessOrNull(MatButtonHarness);
129
+ const icon = await button.getHarnessOrNull(MatIconHarness);
130
+ expect(icon).toBe(null);
131
+ });
132
+
133
+ it('should emit buttonClick event when clicked', fakeAsync(async () => {
134
+ const clickSpy = spyOn(component.buttonClick, 'emit');
135
+ const button = await loader.getHarnessOrNull(MatButtonHarness);
136
+
137
+ button.click();
138
+ tick();
139
+
140
+ expect(clickSpy).toHaveBeenCalled();
141
+ }));
142
+ });
@@ -0,0 +1,22 @@
1
+ import { NgClass } from '@angular/common';
2
+ import { ChangeDetectionStrategy, Component, input, output } from '@angular/core';
3
+ import { MatButtonModule } from '@angular/material/button';
4
+ import { MatIconModule } from '@angular/material/icon';
5
+
6
+ @Component({
7
+ selector: 'cauca-button',
8
+ templateUrl: './button.component.html',
9
+ styleUrls: ['./button.component.scss'],
10
+ imports: [MatIconModule, MatButtonModule, NgClass],
11
+ changeDetection: ChangeDetectionStrategy.OnPush
12
+ })
13
+ export class ButtonComponent {
14
+ public class = input<string | null>(null);
15
+ public inProgress = input<boolean>(false);
16
+ public disable = input<boolean>(false);
17
+ public label = input<string>('');
18
+ public icon = input<string | null>(null);
19
+ public color = input<string>('');
20
+ public type = input<'basic' | 'raised' | 'stroked' | 'flat' | 'icon' | 'fab'>('basic');
21
+ public buttonClick = output<void>();
22
+ }
@@ -0,0 +1,35 @@
1
+ import { InputSignal, input, computed, output, Directive, OutputEmitterRef, signal } from "@angular/core";
2
+
3
+ @Directive()
4
+ export abstract class BaseButton {
5
+ public colorOnHover: InputSignal<string> = input(undefined);
6
+ public color: InputSignal<string> = input(undefined);
7
+ public icon: InputSignal<string> = input();
8
+ public iconAlignment: InputSignal<'left' | 'right'> = input('left');
9
+ public isDisabled: InputSignal<boolean> = input(false);
10
+ public isInProgress: InputSignal<boolean> = input(false);
11
+
12
+ public iconColor = computed(() => this.isHovered() ? this.colorOnHover() || this.color() : this.color());
13
+ public showIcon = computed(() => !!this.icon() || this.isInProgress());
14
+ public iconToShow = computed(() => this.isInProgress() ? 'update' : this.icon());
15
+ public buttonDisabled = computed(() => this.isDisabled() || this.isInProgress());
16
+
17
+ public buttonClick: OutputEmitterRef<void> = output();
18
+
19
+ public isHovered = signal(false);
20
+
21
+ public onMouseEnter(): void {
22
+ this.isHovered.set(true);
23
+ }
24
+
25
+ public onMouseLeave(): void {
26
+ this.isHovered.set(false);
27
+ }
28
+ }
29
+
30
+ @Directive()
31
+ export abstract class BaseButtonWithLabel extends BaseButton {
32
+ public translateLabel: InputSignal<boolean> = input(true);
33
+ public label: InputSignal<string> = input();
34
+ public small: InputSignal<boolean> = input(false);
35
+ }
@@ -0,0 +1,5 @@
1
+ <button mat-button [ngClass]="small() ? 'small-button' : ''" [color]="color()" onclick="this.blur()" [disabled]="buttonDisabled()" (click)="buttonClick.emit()">
2
+ @if(showIcon() && iconAlignment() === 'left') { <mat-icon [class.button-spin]="isInProgress()">{{iconToShow()}}</mat-icon> }
3
+ @if (translateLabel()) {{{label()|translate}}} @else {{{label()}}}
4
+ @if(showIcon() && iconAlignment() === 'right') { <mat-icon [class.button-spin]="isInProgress()">{{iconToShow()}}</mat-icon> }
5
+ </button>
@@ -0,0 +1,12 @@
1
+ .mdc-button.mat-white,
2
+ .mat-stroked-button.mat-white {
3
+ color: white;
4
+ border-color: white;
5
+ }
6
+ .mdc-button.mat-white:hover,
7
+ .mat-mdc-outlined-button.mat-white:hover {
8
+ background-color: transparent;
9
+ }
10
+ mat-icon {
11
+ color: inherit;
12
+ }
@@ -0,0 +1,106 @@
1
+ import { ComponentFixture, TestBed } from '@angular/core/testing';
2
+
3
+ import { BasicButtonComponent } from './basic-button.component';
4
+ import { MatIconHarness } from '@angular/material/icon/testing';
5
+ import { MatButtonHarness } from '@angular/material/button/testing';
6
+ import { TestbedHarnessEnvironment } from '@angular/cdk/testing/testbed';
7
+ import { HarnessLoader } from '@angular/cdk/testing';
8
+ import { TranslatePipe } from '@ngx-translate/core';
9
+ import { MockPipe } from 'ng-mocks';
10
+
11
+ describe('BasicButtonComponent', () => {
12
+ let component: BasicButtonComponent;
13
+ let fixture: ComponentFixture<BasicButtonComponent>;
14
+ let loader: HarnessLoader;
15
+
16
+ beforeEach(async () => {
17
+ await TestBed.configureTestingModule({
18
+ imports: [
19
+ BasicButtonComponent,
20
+ ],
21
+ declarations: [MockPipe(TranslatePipe, key => key)]
22
+ })
23
+ .compileComponents();
24
+
25
+ fixture = TestBed.createComponent(BasicButtonComponent);
26
+ loader = TestbedHarnessEnvironment.loader(fixture);
27
+ component = fixture.componentInstance;
28
+ fixture.detectChanges();
29
+ });
30
+
31
+ it('should create', () => {
32
+ expect(component).toBeTruthy();
33
+ });
34
+
35
+ it('should display the provided icon', async() => {
36
+ fixture.componentRef.setInput('icon', 'twidelidou');
37
+
38
+ fixture.detectChanges();
39
+
40
+ const icon = await loader.getHarness(MatIconHarness);
41
+ expect(await icon.getName()).toBe(component.icon());
42
+ });
43
+
44
+ it('should display the label', async () => {
45
+ fixture.componentRef.setInput('label', 'twidelidou');
46
+
47
+ fixture.detectChanges();
48
+
49
+ const button = await loader.getHarness(MatButtonHarness);
50
+ expect(await button.getText()).toContain(component.label());
51
+ });
52
+
53
+ it('should disable button when disabled is set', async () => {
54
+ fixture.componentRef.setInput('isDisabled', true);
55
+
56
+ const button = await loader.getHarnessOrNull(MatButtonHarness);
57
+ expect(await button.isDisabled()).toBeTrue();
58
+ });
59
+
60
+ it('should enable button when disabled is not set', async () => {
61
+ fixture.componentRef.setInput('isDisabled', false);
62
+
63
+ const button = await loader.getHarnessOrNull(MatButtonHarness);
64
+ expect(await button.isDisabled()).toBeFalse();
65
+ });
66
+
67
+ it('should disable button when disabled is not set and show load icon', async () => {
68
+ fixture.componentRef.setInput('isInProgress', true);
69
+
70
+ const button = await loader.getHarnessOrNull(MatButtonHarness);
71
+ const icon = await button.getHarness(MatIconHarness);
72
+ expect(await button.isDisabled()).toBeTrue();
73
+ expect(await icon.getName()).toBe('update');
74
+ });
75
+
76
+ it('should not show any icon when not set', async () => {
77
+ fixture.componentRef.setInput('icon', null);
78
+
79
+ const button = await loader.getHarnessOrNull(MatButtonHarness);
80
+ const icon = await button.getHarnessOrNull(MatIconHarness);
81
+ expect(icon).toBe(null);
82
+ });
83
+
84
+ it('should emit buttonClick event when clicked', async () => {
85
+ const clickSpy = spyOn(component.buttonClick, 'emit');
86
+ const button = await loader.getHarness(MatButtonHarness);
87
+
88
+ await button.click();
89
+
90
+ expect(clickSpy).toHaveBeenCalled();
91
+ });
92
+
93
+ it('should add small-button class when small is set', () => {
94
+ fixture.componentRef.setInput('small', false);
95
+
96
+ fixture.detectChanges();
97
+
98
+ expect(fixture.nativeElement.querySelector('button')).not.toHaveClass('small-button');
99
+
100
+ fixture.componentRef.setInput('small', true);
101
+
102
+ fixture.detectChanges();
103
+
104
+ expect(fixture.nativeElement.querySelector('button')).toHaveClass('small-button');
105
+ });
106
+ });
@@ -0,0 +1,17 @@
1
+ import { NgClass } from '@angular/common';
2
+ import { ChangeDetectionStrategy, Component } from '@angular/core';
3
+ import { MatButton } from '@angular/material/button';
4
+ import { MatIcon } from '@angular/material/icon';
5
+ import { TranslateModule } from '@ngx-translate/core';
6
+ import { BaseButtonWithLabel } from '../base-button';
7
+
8
+ @Component({
9
+ selector: 'cauca-basic-button',
10
+ standalone: true,
11
+ changeDetection: ChangeDetectionStrategy.OnPush,
12
+ imports: [MatIcon, MatButton, TranslateModule, NgClass],
13
+ templateUrl: './basic-button.component.html',
14
+ styleUrl: './basic-button.component.scss'
15
+ })
16
+ export class BasicButtonComponent extends BaseButtonWithLabel {
17
+ }
@@ -0,0 +1,3 @@
1
+ <button mat-fab [color]="color()" onclick="this.blur()" [disabled]="buttonDisabled()" (click)="buttonClick.emit()">
2
+ @if (showIcon()) { <mat-icon [style.color]="iconColor()" [class.button-spin]="isInProgress()">{{iconToShow()}}</mat-icon> }
3
+ </button>
@@ -0,0 +1,12 @@
1
+ .mdc-button.mat-white,
2
+ .mat-mdc-fab {
3
+ color: white;
4
+ border-color: white;
5
+ }
6
+ .mdc-button.mat-white:hover,
7
+ .mat-mdc-outlined-button.mat-white:hover {
8
+ background-color: transparent;
9
+ }
10
+ mat-icon {
11
+ color: inherit;
12
+ }
@@ -0,0 +1,82 @@
1
+ import { ComponentFixture, TestBed } from '@angular/core/testing';
2
+
3
+ import { FabButtonComponent } from './fab-button.component';
4
+ import { HarnessLoader } from '@angular/cdk/testing';
5
+ import {MatIconHarness} from '@angular/material/icon/testing';
6
+ import { TestbedHarnessEnvironment } from '@angular/cdk/testing/testbed';
7
+ import { MatButtonHarness } from '@angular/material/button/testing';
8
+
9
+ describe('FabButtonComponent', () => {
10
+ let component: FabButtonComponent;
11
+ let fixture: ComponentFixture<FabButtonComponent>;
12
+ let loader: HarnessLoader;
13
+
14
+ beforeEach(async () => {
15
+ await TestBed.configureTestingModule({
16
+ imports: [
17
+ FabButtonComponent,
18
+ ]
19
+ })
20
+ .compileComponents();
21
+
22
+ fixture = TestBed.createComponent(FabButtonComponent);
23
+ loader = TestbedHarnessEnvironment.loader(fixture);
24
+ component = fixture.componentInstance;
25
+ fixture.detectChanges();
26
+ });
27
+
28
+ it('should create', () => {
29
+ expect(component).toBeTruthy();
30
+ });
31
+
32
+ it('should display the provided icon', async() => {
33
+ fixture.componentRef.setInput('icon', 'twidelidou');
34
+
35
+ fixture.detectChanges();
36
+
37
+ const icon = await loader.getHarness(MatIconHarness);
38
+ expect(await icon.getName()).toBe(component.icon());
39
+ });
40
+
41
+ it('should disable button when disabled is set', async () => {
42
+ fixture.componentRef.setInput('isDisabled', true);
43
+
44
+ const button = await loader.getHarnessOrNull(MatButtonHarness);
45
+ expect(await button.isDisabled()).toBeTrue();
46
+ });
47
+
48
+ it('should enable button when disabled is not set', async () => {
49
+ fixture.componentRef.setInput('isDisabled', false);
50
+
51
+ const button = await loader.getHarnessOrNull(MatButtonHarness);
52
+ expect(await button.isDisabled()).toBeFalse();
53
+ });
54
+
55
+ it('should disable button when disabled is not set and show load icon', async () => {
56
+ fixture.componentRef.setInput('isInProgress', true);
57
+
58
+ fixture.detectChanges();
59
+
60
+ const button = await loader.getHarnessOrNull(MatButtonHarness);
61
+ const icon = await button.getHarness(MatIconHarness);
62
+ expect(await button.isDisabled()).toBeTrue();
63
+ expect(await icon.getName()).toBe('update');
64
+ });
65
+
66
+ it('should not show any icon when not set', async () => {
67
+ fixture.componentRef.setInput('icon', null);
68
+
69
+ const button = await loader.getHarnessOrNull(MatButtonHarness);
70
+ const icon = await button.getHarnessOrNull(MatIconHarness);
71
+ expect(icon).toBe(null);
72
+ });
73
+
74
+ it('should emit buttonClick event when clicked', async () => {
75
+ const clickSpy = spyOn(component.buttonClick, 'emit');
76
+ const button = await loader.getHarness(MatButtonHarness);
77
+
78
+ await button.click();
79
+
80
+ expect(clickSpy).toHaveBeenCalled();
81
+ });
82
+ });
@@ -0,0 +1,16 @@
1
+ import { ChangeDetectionStrategy, Component, computed } from '@angular/core';
2
+ import { MatButtonModule, } from '@angular/material/button';
3
+ import { MatIconModule } from '@angular/material/icon';
4
+ import { BaseButtonWithLabel } from '../base-button';
5
+
6
+ @Component({
7
+ selector: 'cauca-fab-button',
8
+ standalone: true,
9
+ changeDetection: ChangeDetectionStrategy.OnPush,
10
+ imports: [MatButtonModule, MatIconModule],
11
+ templateUrl: './fab-button.component.html',
12
+ styleUrl: './fab-button.component.scss',
13
+ })
14
+ export class FabButtonComponent extends BaseButtonWithLabel {
15
+ public iconColor = computed(() => this.color() === 'primary' ? 'white' : undefined);
16
+ }
@@ -0,0 +1,5 @@
1
+ <button mat-flat-button [ngClass]="small() ? 'small-button' : ''" [color]="color()" onclick="this.blur()" [disabled]="buttonDisabled()" (click)="buttonClick.emit();">
2
+ @if(showIcon() && iconAlignment() === 'left') { <mat-icon [class.button-spin]="isInProgress()">{{iconToShow()}}</mat-icon> }
3
+ @if (translateLabel()) {{{label()|translate}}} @else {{{label()}}}
4
+ @if(showIcon() && iconAlignment() === 'right') { <mat-icon [class.button-spin]="isInProgress()">{{iconToShow()}}</mat-icon> }
5
+ </button>
@@ -0,0 +1,12 @@
1
+ .mdc-button.mat-white,
2
+ .mat-stroked-button.mat-white {
3
+ color: white;
4
+ border-color: white;
5
+ }
6
+ .mdc-button.mat-white:hover,
7
+ .mat-mdc-outlined-button.mat-white:hover {
8
+ background-color: transparent;
9
+ }
10
+ mat-icon {
11
+ color: inherit;
12
+ }
@@ -0,0 +1,106 @@
1
+ import { ComponentFixture, TestBed } from '@angular/core/testing';
2
+
3
+ import { FlatButtonComponent } from './flat-button.component';
4
+ import { MatIconHarness } from '@angular/material/icon/testing';
5
+ import { MatButtonHarness } from '@angular/material/button/testing';
6
+ import { TestbedHarnessEnvironment } from '@angular/cdk/testing/testbed';
7
+ import { HarnessLoader } from '@angular/cdk/testing';
8
+ import { TranslatePipe } from '@ngx-translate/core';
9
+ import { MockPipe } from 'ng-mocks';
10
+
11
+ describe('FlatButtonComponent', () => {
12
+ let component: FlatButtonComponent;
13
+ let fixture: ComponentFixture<FlatButtonComponent>;
14
+ let loader: HarnessLoader;
15
+
16
+ beforeEach(async () => {
17
+ await TestBed.configureTestingModule({
18
+ imports: [
19
+ FlatButtonComponent,
20
+ ],
21
+ declarations: [MockPipe(TranslatePipe, key => key)]
22
+ })
23
+ .compileComponents();
24
+
25
+ fixture = TestBed.createComponent(FlatButtonComponent);
26
+ loader = TestbedHarnessEnvironment.loader(fixture);
27
+ component = fixture.componentInstance;
28
+ fixture.detectChanges();
29
+ });
30
+
31
+ it('should create', () => {
32
+ expect(component).toBeTruthy();
33
+ });
34
+
35
+ it('should display the provided icon', async() => {
36
+ fixture.componentRef.setInput('icon', 'twidelidou');
37
+
38
+ fixture.detectChanges();
39
+
40
+ const icon = await loader.getHarness(MatIconHarness);
41
+ expect(await icon.getName()).toBe(component.icon());
42
+ });
43
+
44
+ it('should display the label', async () => {
45
+ fixture.componentRef.setInput('label', 'twidelidou');
46
+
47
+ fixture.detectChanges();
48
+
49
+ const button = await loader.getHarness(MatButtonHarness);
50
+ expect(await button.getText()).toContain(component.label());
51
+ });
52
+
53
+ it('should disable button when disabled is set', async () => {
54
+ fixture.componentRef.setInput('isDisabled', true);
55
+
56
+ const button = await loader.getHarnessOrNull(MatButtonHarness);
57
+ expect(await button.isDisabled()).toBeTrue();
58
+ });
59
+
60
+ it('should enable button when disabled is not set', async () => {
61
+ fixture.componentRef.setInput('isDisabled', false);
62
+
63
+ const button = await loader.getHarnessOrNull(MatButtonHarness);
64
+ expect(await button.isDisabled()).toBeFalse();
65
+ });
66
+
67
+ it('should disable button when disabled is not set and show load icon', async () => {
68
+ fixture.componentRef.setInput('isInProgress', true);
69
+
70
+ const button = await loader.getHarnessOrNull(MatButtonHarness);
71
+ const icon = await button.getHarness(MatIconHarness);
72
+ expect(await button.isDisabled()).toBeTrue();
73
+ expect(await icon.getName()).toBe('update');
74
+ });
75
+
76
+ it('should not show any icon when not set', async () => {
77
+ fixture.componentRef.setInput('icon', null);
78
+
79
+ const button = await loader.getHarnessOrNull(MatButtonHarness);
80
+ const icon = await button.getHarnessOrNull(MatIconHarness);
81
+ expect(icon).toBe(null);
82
+ });
83
+
84
+ it('should emit buttonClick event when clicked', async () => {
85
+ const clickSpy = spyOn(component.buttonClick, 'emit');
86
+ const button = await loader.getHarness(MatButtonHarness);
87
+
88
+ await button.click();
89
+
90
+ expect(clickSpy).toHaveBeenCalled();
91
+ });
92
+
93
+ it('should add small-button class when small is set', () => {
94
+ fixture.componentRef.setInput('small', false);
95
+
96
+ fixture.detectChanges();
97
+
98
+ expect(fixture.nativeElement.querySelector('button')).not.toHaveClass('small-button');
99
+
100
+ fixture.componentRef.setInput('small', true);
101
+
102
+ fixture.detectChanges();
103
+
104
+ expect(fixture.nativeElement.querySelector('button')).toHaveClass('small-button');
105
+ });
106
+ });
@@ -0,0 +1,17 @@
1
+ import { NgClass } from '@angular/common';
2
+ import { ChangeDetectionStrategy, Component } from '@angular/core';
3
+ import { MatButton } from '@angular/material/button';
4
+ import { MatIcon } from '@angular/material/icon';
5
+ import { TranslateModule } from '@ngx-translate/core';
6
+ import { BaseButtonWithLabel } from '../base-button';
7
+
8
+ @Component({
9
+ selector: 'cauca-flat-button',
10
+ standalone: true,
11
+ changeDetection: ChangeDetectionStrategy.OnPush,
12
+ imports: [MatIcon, MatButton, TranslateModule, NgClass],
13
+ templateUrl: './flat-button.component.html',
14
+ styleUrl: './flat-button.component.scss'
15
+ })
16
+ export class FlatButtonComponent extends BaseButtonWithLabel {
17
+ }
@@ -0,0 +1,3 @@
1
+ <button (mouseenter)="onMouseEnter()" (mouseleave)="onMouseLeave()" mat-icon-button onclick="this.blur()" (click)="buttonClick.emit();" [disabled]="buttonDisabled()">
2
+ <mat-icon [style.color]="iconColor()" [class.button-spin]="isInProgress()">{{iconToShow()}}</mat-icon>
3
+ </button>
@@ -0,0 +1,23 @@
1
+ :host {
2
+ display: flex;
3
+ }
4
+
5
+ .mdc-button.mat-white,
6
+ .mat-stroked-button.mat-white {
7
+ color: white;
8
+ border-color: white;
9
+ }
10
+ .mdc-button.mat-white:hover,
11
+ .mat-mdc-outlined-button.mat-white:hover {
12
+ background-color: transparent;
13
+ }
14
+
15
+ mat-icon {
16
+ color: #006496;
17
+ }
18
+
19
+ .mat-mdc-button-disabled {
20
+ .mat-icon {
21
+ color: rgba(18, 16, 20, 0.38);
22
+ }
23
+ }
@@ -0,0 +1,38 @@
1
+ import { ComponentFixture, TestBed } from '@angular/core/testing';
2
+
3
+ import { IconButtonComponent } from './icon-button.component';
4
+ import { HarnessLoader } from '@angular/cdk/testing';
5
+ import { TestbedHarnessEnvironment } from '@angular/cdk/testing/testbed';
6
+ import { MatIconHarness } from '@angular/material/icon/testing';
7
+
8
+ describe('IconButtonComponent', () => {
9
+ let component: IconButtonComponent;
10
+ let fixture: ComponentFixture<IconButtonComponent>;
11
+ let loader: HarnessLoader;
12
+
13
+ beforeEach(async () => {
14
+ await TestBed.configureTestingModule({
15
+ imports: [IconButtonComponent]
16
+ })
17
+ .compileComponents();
18
+
19
+ fixture = TestBed.createComponent(IconButtonComponent);
20
+ loader = TestbedHarnessEnvironment.loader(fixture);
21
+ component = fixture.componentInstance;
22
+ fixture.detectChanges();
23
+ });
24
+
25
+ it('should create', () => {
26
+ expect(component).toBeTruthy();
27
+ });
28
+
29
+ it('should display the provided icon', async() => {
30
+ fixture.componentRef.setInput('icon', 'twidelidou');
31
+
32
+ fixture.detectChanges();
33
+
34
+ const icon = await loader.getHarness(MatIconHarness);
35
+ expect(await icon.getName()).toBe(component.icon());
36
+ });
37
+
38
+ });