@cauca-911/material 21.0.1-beta.3 → 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.
- package/.eslintrc.json +79 -0
- package/README_PACKAGE.md +5 -0
- package/karma.conf.js +50 -0
- package/ng-package.json +7 -0
- package/package.json +2 -17
- package/src/assets/i18n/cauca/en-material.json +104 -0
- package/src/assets/i18n/cauca/es-material.json +104 -0
- package/src/assets/i18n/cauca/fr-material.json +106 -0
- package/src/assets/images/loading.gif +0 -0
- package/src/lib/cauca-material.component.html +1 -0
- package/src/lib/cauca-material.component.spec.ts +29 -0
- package/src/lib/cauca-material.component.ts +12 -0
- package/src/lib/cauca-material.service.spec.ts +16 -0
- package/src/lib/cauca-material.service.ts +7 -0
- package/src/lib/components/button/button.component.html +52 -0
- package/src/lib/components/button/button.component.scss +6 -0
- package/src/lib/components/button/button.component.spec.ts +142 -0
- package/src/lib/components/button/button.component.ts +22 -0
- package/src/lib/components/buttons/base-button.ts +35 -0
- package/src/lib/components/buttons/basic-button/basic-button.component.html +5 -0
- package/src/lib/components/buttons/basic-button/basic-button.component.scss +12 -0
- package/src/lib/components/buttons/basic-button/basic-button.component.spec.ts +106 -0
- package/src/lib/components/buttons/basic-button/basic-button.component.ts +17 -0
- package/src/lib/components/buttons/fab-button/fab-button.component.html +3 -0
- package/src/lib/components/buttons/fab-button/fab-button.component.scss +12 -0
- package/src/lib/components/buttons/fab-button/fab-button.component.spec.ts +82 -0
- package/src/lib/components/buttons/fab-button/fab-button.component.ts +16 -0
- package/src/lib/components/buttons/flat-button/flat-button.component.html +5 -0
- package/src/lib/components/buttons/flat-button/flat-button.component.scss +12 -0
- package/src/lib/components/buttons/flat-button/flat-button.component.spec.ts +106 -0
- package/src/lib/components/buttons/flat-button/flat-button.component.ts +17 -0
- package/src/lib/components/buttons/icon-button/icon-button.component.html +3 -0
- package/src/lib/components/buttons/icon-button/icon-button.component.scss +23 -0
- package/src/lib/components/buttons/icon-button/icon-button.component.spec.ts +38 -0
- package/src/lib/components/buttons/icon-button/icon-button.component.ts +15 -0
- package/src/lib/components/buttons/link-button/link-button.component.html +1 -0
- package/src/lib/components/buttons/link-button/link-button.component.scss +3 -0
- package/src/lib/components/buttons/link-button/link-button.component.spec.ts +97 -0
- package/src/lib/components/buttons/link-button/link-button.component.ts +25 -0
- package/src/lib/components/buttons/menu-item/menu-item.component.html +5 -0
- package/src/lib/components/buttons/menu-item/menu-item.component.scss +6 -0
- package/src/lib/components/buttons/menu-item/menu-item.component.spec.ts +66 -0
- package/src/lib/components/buttons/menu-item/menu-item.component.ts +19 -0
- package/src/lib/components/buttons/raised-button/raised-button.component.html +5 -0
- package/src/lib/components/buttons/raised-button/raised-button.component.scss +12 -0
- package/src/lib/components/buttons/raised-button/raised-button.component.spec.ts +108 -0
- package/src/lib/components/buttons/raised-button/raised-button.component.ts +17 -0
- package/src/lib/components/buttons/refresh-button/refresh-button.component.html +1 -0
- package/src/lib/components/buttons/refresh-button/refresh-button.component.scss +0 -0
- package/src/lib/components/buttons/refresh-button/refresh-button.component.spec.ts +81 -0
- package/src/lib/components/buttons/refresh-button/refresh-button.component.ts +19 -0
- package/src/lib/components/buttons/round-button/round-button.component.html +3 -0
- package/src/lib/components/buttons/round-button/round-button.component.scss +34 -0
- package/src/lib/components/buttons/round-button/round-button.component.spec.ts +26 -0
- package/src/lib/components/buttons/round-button/round-button.component.ts +14 -0
- package/src/lib/components/buttons/stroked-button/stroked-button.component.html +5 -0
- package/src/lib/components/buttons/stroked-button/stroked-button.component.scss +23 -0
- package/src/lib/components/buttons/stroked-button/stroked-button.component.spec.ts +114 -0
- package/src/lib/components/buttons/stroked-button/stroked-button.component.ts +17 -0
- package/src/lib/components/cauca-date-time-picker/cauca-date-time-picker.component.html +9 -0
- package/src/lib/components/cauca-date-time-picker/cauca-date-time-picker.component.scss +7 -0
- package/src/lib/components/cauca-date-time-picker/cauca-date-time-picker.component.spec.ts +68 -0
- package/src/lib/components/cauca-date-time-picker/cauca-date-time-picker.component.ts +155 -0
- package/src/lib/components/cauca-date-time-picker/components/desktop-time-picker/desktop-time-picker.component.html +6 -0
- package/src/lib/components/cauca-date-time-picker/components/desktop-time-picker/desktop-time-picker.component.scss +25 -0
- package/src/lib/components/cauca-date-time-picker/components/desktop-time-picker/desktop-time-picker.component.spec.ts +23 -0
- package/src/lib/components/cauca-date-time-picker/components/desktop-time-picker/desktop-time-picker.component.ts +23 -0
- package/src/lib/components/cauca-date-time-picker/components/dialog-date-time-picker/dialog-date-time-picker.component.html +77 -0
- package/src/lib/components/cauca-date-time-picker/components/dialog-date-time-picker/dialog-date-time-picker.component.scss +124 -0
- package/src/lib/components/cauca-date-time-picker/components/dialog-date-time-picker/dialog-date-time-picker.component.spec.ts +96 -0
- package/src/lib/components/cauca-date-time-picker/components/dialog-date-time-picker/dialog-date-time-picker.component.ts +228 -0
- package/src/lib/components/cauca-date-time-picker/components/mobile-time-picker/mobile-time-picker.component.html +9 -0
- package/src/lib/components/cauca-date-time-picker/components/mobile-time-picker/mobile-time-picker.component.scss +15 -0
- package/src/lib/components/cauca-date-time-picker/components/mobile-time-picker/mobile-time-picker.component.spec.ts +105 -0
- package/src/lib/components/cauca-date-time-picker/components/mobile-time-picker/mobile-time-picker.component.ts +48 -0
- package/src/lib/components/cauca-date-time-picker/models/dialog-date-time-picker-data.ts +29 -0
- package/src/lib/components/deprecated-components/cauca-input-file/cauca-input-file.component.html +14 -0
- package/src/lib/components/deprecated-components/cauca-input-file/cauca-input-file.component.scss +3 -0
- package/src/lib/components/deprecated-components/cauca-input-file/cauca-input-file.component.ts +87 -0
- package/src/lib/components/deprecated-components/cauca-input-multiple-langue/cauca-input-multiple-langue.component.html +12 -0
- package/src/lib/components/deprecated-components/cauca-input-multiple-langue/cauca-input-multiple-langue.component.scss +3 -0
- package/src/lib/components/deprecated-components/cauca-input-multiple-langue/cauca-input-multiple-langue.component.spec.ts +35 -0
- package/src/lib/components/deprecated-components/cauca-input-multiple-langue/cauca-input-multiple-langue.component.ts +57 -0
- package/src/lib/components/deprecated-components/cauca-menu-vertical/cauca-menu-vertical.component.html +49 -0
- package/src/lib/components/deprecated-components/cauca-menu-vertical/cauca-menu-vertical.component.ts +56 -0
- package/src/lib/components/deprecated-components/cauca-simple-dialog/cauca-simple-dialog.component.html +11 -0
- package/src/lib/components/deprecated-components/cauca-simple-dialog/cauca-simple-dialog.component.scss +4 -0
- package/src/lib/components/deprecated-components/cauca-simple-dialog/cauca-simple-dialog.component.spec.ts +39 -0
- package/src/lib/components/deprecated-components/cauca-simple-dialog/cauca-simple-dialog.component.ts +20 -0
- package/src/lib/components/deprecated-components/cauca-slideshow/cauca-slideshow.component.html +7 -0
- package/src/lib/components/deprecated-components/cauca-slideshow/cauca-slideshow.component.scss +41 -0
- package/src/lib/components/deprecated-components/cauca-slideshow/cauca-slideshow.component.spec.ts +24 -0
- package/src/lib/components/deprecated-components/cauca-slideshow/cauca-slideshow.component.ts +67 -0
- package/src/lib/components/deprecated-components/shared/models/menu-item.ts +11 -0
- package/src/lib/components/deprecated-components/shared/models/simple-dialog-data.ts +5 -0
- package/src/lib/components/dialogs/alert-dialog/alert-dialog.component.html +10 -0
- package/src/lib/components/dialogs/alert-dialog/alert-dialog.component.scss +14 -0
- package/src/lib/components/dialogs/alert-dialog/alert-dialog.component.spec.ts +90 -0
- package/src/lib/components/dialogs/alert-dialog/alert-dialog.component.ts +41 -0
- package/src/lib/components/dialogs/confirm-dialog/confirm-dialog.component.html +11 -0
- package/src/lib/components/dialogs/confirm-dialog/confirm-dialog.component.scss +29 -0
- package/src/lib/components/dialogs/confirm-dialog/confirm-dialog.component.spec.ts +137 -0
- package/src/lib/components/dialogs/confirm-dialog/confirm-dialog.component.ts +47 -0
- package/src/lib/components/dialogs/delete-dialog/delete-dialog.component.html +17 -0
- package/src/lib/components/dialogs/delete-dialog/delete-dialog.component.scss +14 -0
- package/src/lib/components/dialogs/delete-dialog/delete-dialog.component.spec.ts +96 -0
- package/src/lib/components/dialogs/delete-dialog/delete-dialog.component.ts +40 -0
- package/src/lib/components/dialogs/delete-dialog/models/delete-dialog-data.spec.ts +7 -0
- package/src/lib/components/dialogs/delete-dialog/models/delete-dialog-data.ts +5 -0
- package/src/lib/components/dialogs/dialog-styles.css +9 -0
- package/src/lib/components/dialogs/dialog-styles.scss +9 -0
- package/src/lib/components/dialogs/error-dialog/error-dialog.component.html +10 -0
- package/src/lib/components/dialogs/error-dialog/error-dialog.component.scss +10 -0
- package/src/lib/components/dialogs/error-dialog/error-dialog.component.spec.ts +91 -0
- package/src/lib/components/dialogs/error-dialog/error-dialog.component.ts +32 -0
- package/src/lib/components/dialogs/services/dialog.service.spec.ts +82 -0
- package/src/lib/components/dialogs/services/dialog.service.ts +107 -0
- package/src/lib/components/dialogs/text-input-dialog/text-input-dialog.component.html +24 -0
- package/src/lib/components/dialogs/text-input-dialog/text-input-dialog.component.scss +22 -0
- package/src/lib/components/dialogs/text-input-dialog/text-input-dialog.component.spec.ts +126 -0
- package/src/lib/components/dialogs/text-input-dialog/text-input-dialog.component.ts +66 -0
- package/src/lib/components/inputs/color-picker/color-picker.component.html +9 -0
- package/src/lib/components/inputs/color-picker/color-picker.component.scss +0 -0
- package/src/lib/components/inputs/color-picker/color-picker.component.spec.ts +29 -0
- package/src/lib/components/inputs/color-picker/color-picker.component.ts +111 -0
- package/src/lib/components/inputs/date-range-picker/date-range-picker.component.html +13 -0
- package/src/lib/components/inputs/date-range-picker/date-range-picker.component.scss +0 -0
- package/src/lib/components/inputs/date-range-picker/date-range-picker.component.spec.ts +80 -0
- package/src/lib/components/inputs/date-range-picker/date-range-picker.component.ts +46 -0
- package/src/lib/components/inputs/dropdown-chip-autocomplete/dropdown-chip-autocomplete.component.html +40 -0
- package/src/lib/components/inputs/dropdown-chip-autocomplete/dropdown-chip-autocomplete.component.scss +39 -0
- package/src/lib/components/inputs/dropdown-chip-autocomplete/dropdown-chip-autocomplete.component.spec.ts +135 -0
- package/src/lib/components/inputs/dropdown-chip-autocomplete/dropdown-chip-autocomplete.component.ts +263 -0
- package/src/lib/components/inputs/password/password-criteria/password-criteria.component.html +6 -0
- package/src/lib/components/inputs/password/password-criteria/password-criteria.component.scss +27 -0
- package/src/lib/components/inputs/password/password-criteria/password-criteria.component.spec.ts +90 -0
- package/src/lib/components/inputs/password/password-criteria/password-criteria.component.ts +17 -0
- package/src/lib/components/inputs/password/password-criteria-viewer/password-criteria-viewer.component.html +5 -0
- package/src/lib/components/inputs/password/password-criteria-viewer/password-criteria-viewer.component.scss +8 -0
- package/src/lib/components/inputs/password/password-criteria-viewer/password-criteria-viewer.component.spec.ts +98 -0
- package/src/lib/components/inputs/password/password-criteria-viewer/password-criteria-viewer.component.ts +16 -0
- package/src/lib/components/inputs/password/password-input/password-input.component.html +11 -0
- package/src/lib/components/inputs/password/password-input/password-input.component.scss +12 -0
- package/src/lib/components/inputs/password/password-input/password-input.component.spec.ts +141 -0
- package/src/lib/components/inputs/password/password-input/password-input.component.ts +67 -0
- package/src/lib/components/inputs/password/password-selection/password-selection.component.html +15 -0
- package/src/lib/components/inputs/password/password-selection/password-selection.component.scss +32 -0
- package/src/lib/components/inputs/password/password-selection/password-selection.component.spec.ts +138 -0
- package/src/lib/components/inputs/password/password-selection/password-selection.component.ts +101 -0
- package/src/lib/components/inputs/select-with-search/select-with-search.component.html +19 -0
- package/src/lib/components/inputs/select-with-search/select-with-search.component.scss +0 -0
- package/src/lib/components/inputs/select-with-search/select-with-search.component.spec.ts +215 -0
- package/src/lib/components/inputs/select-with-search/select-with-search.component.ts +108 -0
- package/src/lib/components/layout/expandable-panel/expandable-panel.component.html +14 -0
- package/src/lib/components/layout/expandable-panel/expandable-panel.component.scss +48 -0
- package/src/lib/components/layout/expandable-panel/expandable-panel.component.spec.ts +48 -0
- package/src/lib/components/layout/expandable-panel/expandable-panel.component.ts +19 -0
- package/src/lib/components/layout/group-container/group-container.component.html +6 -0
- package/src/lib/components/layout/group-container/group-container.component.scss +22 -0
- package/src/lib/components/layout/group-container/group-container.component.spec.ts +34 -0
- package/src/lib/components/layout/group-container/group-container.component.ts +14 -0
- package/src/lib/components/layout/menu-expandable-panel/menu-expandable-panel.component.html +13 -0
- package/src/lib/components/layout/menu-expandable-panel/menu-expandable-panel.component.scss +27 -0
- package/src/lib/components/layout/menu-expandable-panel/menu-expandable-panel.component.spec.ts +144 -0
- package/src/lib/components/layout/menu-expandable-panel/menu-expandable-panel.component.ts +52 -0
- package/src/lib/components/layout/menu-expandable-panel-item/menu-expandable-panel-item.component.html +4 -0
- package/src/lib/components/layout/menu-expandable-panel-item/menu-expandable-panel-item.component.scss +10 -0
- package/src/lib/components/layout/menu-expandable-panel-item/menu-expandable-panel-item.component.spec.ts +80 -0
- package/src/lib/components/layout/menu-expandable-panel-item/menu-expandable-panel-item.component.ts +28 -0
- package/src/lib/components/layout/page-title/page-title.component.html +35 -0
- package/src/lib/components/layout/page-title/page-title.component.scss +40 -0
- package/src/lib/components/layout/page-title/page-title.component.spec.ts +162 -0
- package/src/lib/components/layout/page-title/page-title.component.ts +28 -0
- package/src/lib/components/layout/sections/main-section/main-section.component.html +6 -0
- package/src/lib/components/layout/sections/main-section/main-section.component.scss +27 -0
- package/src/lib/components/layout/sections/main-section/main-section.component.spec.ts +42 -0
- package/src/lib/components/layout/sections/main-section/main-section.component.ts +13 -0
- package/src/lib/components/layout/sections/section-column/section-column.component.html +3 -0
- package/src/lib/components/layout/sections/section-column/section-column.component.scss +18 -0
- package/src/lib/components/layout/sections/section-column/section-column.component.spec.ts +35 -0
- package/src/lib/components/layout/sections/section-column/section-column.component.ts +12 -0
- package/src/lib/components/layout/sections/section-field/section-field.component.html +21 -0
- package/src/lib/components/layout/sections/section-field/section-field.component.scss +44 -0
- package/src/lib/components/layout/sections/section-field/section-field.component.spec.ts +74 -0
- package/src/lib/components/layout/sections/section-field/section-field.component.ts +22 -0
- package/src/lib/components/list-paginator/list-paginator.component.html +16 -0
- package/src/lib/components/list-paginator/list-paginator.component.scss +46 -0
- package/src/lib/components/list-paginator/list-paginator.component.spec.ts +248 -0
- package/src/lib/components/list-paginator/list-paginator.component.ts +81 -0
- package/src/lib/components/misc/loading-error/loading-error.component.html +11 -0
- package/src/lib/components/misc/loading-error/loading-error.component.scss +0 -0
- package/src/lib/components/misc/loading-error/loading-error.component.spec.ts +75 -0
- package/src/lib/components/misc/loading-error/loading-error.component.ts +18 -0
- package/src/lib/components/misc/loading-spinner-indicator/loading-spinner-indicator.component.html +3 -0
- package/src/lib/components/misc/loading-spinner-indicator/loading-spinner-indicator.component.scss +0 -0
- package/src/lib/components/misc/loading-spinner-indicator/loading-spinner-indicator.component.spec.ts +43 -0
- package/src/lib/components/misc/loading-spinner-indicator/loading-spinner-indicator.component.ts +16 -0
- package/src/lib/components/misc/snack-bar/snack-bar.component.html +16 -0
- package/src/lib/components/misc/snack-bar/snack-bar.component.scss +84 -0
- package/src/lib/components/misc/snack-bar/snack-bar.component.spec.ts +136 -0
- package/src/lib/components/misc/snack-bar/snack-bar.component.ts +39 -0
- package/src/lib/components/notifications/saving-confirmed-box/saving-confirmed-box.component.html +11 -0
- package/src/lib/components/notifications/saving-confirmed-box/saving-confirmed-box.component.scss +0 -0
- package/src/lib/components/notifications/saving-confirmed-box/saving-confirmed-box.component.spec.ts +67 -0
- package/src/lib/components/notifications/saving-confirmed-box/saving-confirmed-box.component.ts +15 -0
- package/src/lib/components/notifications/saving-error-box/saving-error-box.component.html +11 -0
- package/src/lib/components/notifications/saving-error-box/saving-error-box.component.scss +0 -0
- package/src/lib/components/notifications/saving-error-box/saving-error-box.component.spec.ts +77 -0
- package/src/lib/components/notifications/saving-error-box/saving-error-box.component.ts +17 -0
- package/src/lib/components/presenters/badge/badge.component.html +6 -0
- package/src/lib/components/presenters/badge/badge.component.scss +10 -0
- package/src/lib/components/presenters/badge/badge.component.spec.ts +41 -0
- package/src/lib/components/presenters/badge/badge.component.ts +18 -0
- package/src/lib/components/presenters/icon/icon.component.scss +9 -0
- package/src/lib/components/presenters/icon/icon.component.spec.ts +38 -0
- package/src/lib/components/presenters/icon/icon.component.ts +37 -0
- package/src/lib/core/breadcrumb.service.spec.ts +35 -0
- package/src/lib/core/breadcrumb.service.ts +24 -0
- package/src/lib/core/directives/auto-trim-and-lower.directive.spec.ts +22 -0
- package/src/lib/core/directives/auto-trim-and-lower.directive.ts +19 -0
- package/src/lib/core/directives/form-error/form-error.module.ts +21 -0
- package/src/lib/core/directives/form-error/has-error-root.directive.ts +31 -0
- package/src/lib/core/directives/form-error/has-error.directive.ts +95 -0
- package/src/lib/core/loading-state.service.spec.ts +57 -0
- package/src/lib/core/loading-state.service.ts +44 -0
- package/src/lib/core/models/breadcrumb-location.ts +6 -0
- package/src/lib/core/models/password-validation.ts +20 -0
- package/src/lib/core/validators/password/password-validator.spec.ts +155 -0
- package/src/lib/core/validators/password/password-validator.ts +30 -0
- package/src/lib/provide-cauca-material.ts +10 -0
- package/src/public-api.ts +70 -0
- package/src/test.ts +17 -0
- package/tsconfig.lib.json +18 -0
- package/tsconfig.lib.prod.json +4 -0
- package/tsconfig.spec.json +17 -0
- package/fesm2022/cauca-911-material.mjs +0 -4321
- package/fesm2022/cauca-911-material.mjs.map +0 -1
- package/types/cauca-911-material.d.ts +0 -755
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ChangeDetectionStrategy, Component } from '@angular/core';
|
|
2
|
+
import { MatIconButton } from '@angular/material/button';
|
|
3
|
+
import { MatIcon } from '@angular/material/icon';
|
|
4
|
+
import { BaseButton } from '../base-button';
|
|
5
|
+
|
|
6
|
+
@Component({
|
|
7
|
+
selector: 'cauca-icon-button',
|
|
8
|
+
standalone: true,
|
|
9
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
10
|
+
imports: [MatIconButton, MatIcon],
|
|
11
|
+
templateUrl: './icon-button.component.html',
|
|
12
|
+
styleUrl: './icon-button.component.scss'
|
|
13
|
+
})
|
|
14
|
+
export class IconButtonComponent extends BaseButton {
|
|
15
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<cauca-button class="link-button" icon="link" type="stroked" color="primary" (buttonClick)="copyLink()" [label]="'copyLink'|translate" />
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
2
|
+
import { Clipboard } from '@angular/cdk/clipboard';
|
|
3
|
+
import { MockComponents, MockPipe, ngMocks } from 'ng-mocks';
|
|
4
|
+
import { TranslatePipe } from '@ngx-translate/core';
|
|
5
|
+
|
|
6
|
+
import { LinkButtonComponent } from './link-button.component';
|
|
7
|
+
import { ButtonComponent } from '../../button/button.component';
|
|
8
|
+
|
|
9
|
+
describe('LinkButtonComponent', () => {
|
|
10
|
+
let component: LinkButtonComponent;
|
|
11
|
+
let fixture: ComponentFixture<LinkButtonComponent>;
|
|
12
|
+
let clipboardSpy: jasmine.SpyObj<Clipboard>;
|
|
13
|
+
|
|
14
|
+
beforeEach(async () => {
|
|
15
|
+
const clipboard = jasmine.createSpyObj('Clipboard', ['copy']);
|
|
16
|
+
|
|
17
|
+
await TestBed.configureTestingModule({
|
|
18
|
+
imports: [
|
|
19
|
+
LinkButtonComponent,
|
|
20
|
+
...MockComponents(ButtonComponent),
|
|
21
|
+
MockPipe(TranslatePipe, value => value)
|
|
22
|
+
],
|
|
23
|
+
providers: [
|
|
24
|
+
{ provide: Clipboard, useValue: clipboard }
|
|
25
|
+
]
|
|
26
|
+
}).compileComponents();
|
|
27
|
+
|
|
28
|
+
fixture = TestBed.createComponent(LinkButtonComponent);
|
|
29
|
+
component = fixture.componentInstance;
|
|
30
|
+
clipboardSpy = TestBed.inject(Clipboard) as jasmine.SpyObj<Clipboard>;
|
|
31
|
+
fixture.detectChanges();
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
it('should create', () => {
|
|
35
|
+
expect(component).toBeTruthy();
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
it('should render cauca-button with correct properties', () => {
|
|
39
|
+
const buttonElement = ngMocks.find(fixture.debugElement, ButtonComponent);
|
|
40
|
+
const buttonComponent = buttonElement.componentInstance; expect(buttonComponent.icon).toBe('link');
|
|
41
|
+
expect(buttonComponent.type).toBe('stroked');
|
|
42
|
+
expect(buttonComponent.color).toBe('primary');
|
|
43
|
+
expect(buttonComponent.label).toBe('copyLink');
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
it('should have link-button class', () => {
|
|
47
|
+
const buttonElement = ngMocks.find(fixture.debugElement, 'cauca-button');
|
|
48
|
+
|
|
49
|
+
expect(buttonElement.nativeElement.classList).toContain('link-button');
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
describe('copyLink', () => {
|
|
53
|
+
it('should copy correct link when segments are provided', () => {
|
|
54
|
+
fixture.componentRef.setInput('segments', ['path1', 'path2', 'path3']);
|
|
55
|
+
|
|
56
|
+
component.copyLink();
|
|
57
|
+
|
|
58
|
+
const expectedUrl = `${location.origin}/path1/path2/path3`;
|
|
59
|
+
expect(clipboardSpy.copy).toHaveBeenCalledWith(expectedUrl);
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
it('should copy origin only when empty segments array is provided', () => {
|
|
63
|
+
fixture.componentRef.setInput('segments', []);
|
|
64
|
+
|
|
65
|
+
component.copyLink();
|
|
66
|
+
|
|
67
|
+
expect(clipboardSpy.copy).toHaveBeenCalledWith(location.origin);
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
it('should copy link with single segment', () => {
|
|
71
|
+
fixture.componentRef.setInput('segments', ['single-path']);
|
|
72
|
+
|
|
73
|
+
component.copyLink();
|
|
74
|
+
|
|
75
|
+
const expectedUrl = `${location.origin}/single-path`;
|
|
76
|
+
expect(clipboardSpy.copy).toHaveBeenCalledWith(expectedUrl);
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
it('should handle segments with special characters', () => {
|
|
80
|
+
fixture.componentRef.setInput('segments', ['path-with-dash', 'path_with_underscore', 'path123']);
|
|
81
|
+
|
|
82
|
+
component.copyLink();
|
|
83
|
+
|
|
84
|
+
const expectedUrl = `${location.origin}/path-with-dash/path_with_underscore/path123`;
|
|
85
|
+
expect(clipboardSpy.copy).toHaveBeenCalledWith(expectedUrl);
|
|
86
|
+
});
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
it('should call copyLink when button is clicked', () => {
|
|
90
|
+
spyOn(component, 'copyLink');
|
|
91
|
+
const buttonElement = ngMocks.find(fixture.debugElement, ButtonComponent);
|
|
92
|
+
|
|
93
|
+
buttonElement.componentInstance.buttonClick.emit();
|
|
94
|
+
|
|
95
|
+
expect(component.copyLink).toHaveBeenCalled();
|
|
96
|
+
});
|
|
97
|
+
});
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { ChangeDetectionStrategy, Component, input } from '@angular/core';
|
|
2
|
+
import { Clipboard } from '@angular/cdk/clipboard';
|
|
3
|
+
import { ButtonComponent } from '../../button/button.component';
|
|
4
|
+
import { TranslatePipe } from '@ngx-translate/core';
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
@Component({
|
|
8
|
+
selector: 'cauca-link-button',
|
|
9
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
10
|
+
templateUrl: './link-button.component.html',
|
|
11
|
+
styleUrls: ['./link-button.component.scss'],
|
|
12
|
+
imports: [ButtonComponent, TranslatePipe]
|
|
13
|
+
})
|
|
14
|
+
export class LinkButtonComponent {
|
|
15
|
+
public readonly segments = input<string[]>();
|
|
16
|
+
|
|
17
|
+
public constructor(
|
|
18
|
+
private readonly clipboard: Clipboard,
|
|
19
|
+
) {}
|
|
20
|
+
|
|
21
|
+
public copyLink(): void {
|
|
22
|
+
const link = location.origin + this.segments().map((segment: string) => `/${segment}`).join('');
|
|
23
|
+
this.clipboard.copy(link);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
<button (mouseenter)="onMouseEnter()" (mouseleave)="onMouseLeave()" mat-menu-item [ngClass]="small() ? 'small-button' : ''" class="change-password-menu-item" [matMenuTriggerFor]="trigger()" [disabled]="buttonDisabled()" (click)="buttonClick.emit()">
|
|
2
|
+
@if(showIcon() && iconAlignment() === 'left') { <mat-icon [style.color]="iconColor()" [class.button-spin]="isInProgress()">{{iconToShow()}}</mat-icon> }
|
|
3
|
+
@if (translateLabel()) {{{label()|translate}}} @else {{{label()}}}
|
|
4
|
+
@if(showIcon() && iconAlignment() === 'right') { <mat-icon [style.color]="iconColor()" [class.button-spin]="isInProgress()">{{iconToShow()}}</mat-icon> }
|
|
5
|
+
</button>
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
2
|
+
|
|
3
|
+
import { MenuItemComponent } from './menu-item.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
|
+
import { MatMenuItemHarness } from '@angular/material/menu/testing';
|
|
8
|
+
import { TranslatePipe } from '@ngx-translate/core';
|
|
9
|
+
import { MockPipe } from 'ng-mocks';
|
|
10
|
+
|
|
11
|
+
describe('MenuItemComponent', () => {
|
|
12
|
+
let component: MenuItemComponent;
|
|
13
|
+
let fixture: ComponentFixture<MenuItemComponent>;
|
|
14
|
+
let loader: HarnessLoader;
|
|
15
|
+
|
|
16
|
+
beforeEach(async () => {
|
|
17
|
+
await TestBed.configureTestingModule({
|
|
18
|
+
imports: [
|
|
19
|
+
MenuItemComponent,
|
|
20
|
+
],
|
|
21
|
+
declarations: [MockPipe(TranslatePipe, key => key)]
|
|
22
|
+
})
|
|
23
|
+
.compileComponents();
|
|
24
|
+
|
|
25
|
+
fixture = TestBed.createComponent(MenuItemComponent);
|
|
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(MatMenuItemHarness);
|
|
50
|
+
expect(await button.getText()).toContain(component.label());
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
it('should add small-button class when small is set', () => {
|
|
54
|
+
fixture.componentRef.setInput('small', false);
|
|
55
|
+
|
|
56
|
+
fixture.detectChanges();
|
|
57
|
+
|
|
58
|
+
expect(fixture.nativeElement.querySelector('button')).not.toHaveClass('small-button');
|
|
59
|
+
|
|
60
|
+
fixture.componentRef.setInput('small', true);
|
|
61
|
+
|
|
62
|
+
fixture.detectChanges();
|
|
63
|
+
|
|
64
|
+
expect(fixture.nativeElement.querySelector('button')).toHaveClass('small-button');
|
|
65
|
+
});
|
|
66
|
+
});
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { ChangeDetectionStrategy, Component, InputSignal, input, } from '@angular/core';
|
|
2
|
+
import { MatIcon } from '@angular/material/icon';
|
|
3
|
+
import { MatMenuItem, MatMenuTrigger } from '@angular/material/menu';
|
|
4
|
+
import { TranslateModule } from '@ngx-translate/core';
|
|
5
|
+
import { BaseButtonWithLabel } from '../base-button';
|
|
6
|
+
import { NgClass } from '@angular/common';
|
|
7
|
+
|
|
8
|
+
@Component({
|
|
9
|
+
selector: 'cauca-menu-item',
|
|
10
|
+
standalone: true,
|
|
11
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
12
|
+
imports: [MatMenuItem, TranslateModule, MatIcon, MatMenuTrigger, NgClass],
|
|
13
|
+
templateUrl: './menu-item.component.html',
|
|
14
|
+
styleUrl: './menu-item.component.scss',
|
|
15
|
+
})
|
|
16
|
+
export class MenuItemComponent extends BaseButtonWithLabel {
|
|
17
|
+
public translateLabel: InputSignal<boolean> = input(false);
|
|
18
|
+
public trigger: InputSignal<any> = input();
|
|
19
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
<button mat-raised-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,108 @@
|
|
|
1
|
+
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
2
|
+
|
|
3
|
+
import { RaisedButtonComponent } from './raised-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
|
+
import { TranslatePipe } from '@ngx-translate/core';
|
|
9
|
+
import { MockPipe } from 'ng-mocks';
|
|
10
|
+
|
|
11
|
+
describe('RaisedButtonComponent', () => {
|
|
12
|
+
let component: RaisedButtonComponent;
|
|
13
|
+
let fixture: ComponentFixture<RaisedButtonComponent>;
|
|
14
|
+
let loader: HarnessLoader;
|
|
15
|
+
|
|
16
|
+
beforeEach(async () => {
|
|
17
|
+
await TestBed.configureTestingModule({
|
|
18
|
+
imports: [
|
|
19
|
+
RaisedButtonComponent,
|
|
20
|
+
],
|
|
21
|
+
declarations: [MockPipe(TranslatePipe, key => key)]
|
|
22
|
+
})
|
|
23
|
+
.compileComponents();
|
|
24
|
+
|
|
25
|
+
fixture = TestBed.createComponent(RaisedButtonComponent);
|
|
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
|
+
fixture.detectChanges();
|
|
71
|
+
|
|
72
|
+
const button = await loader.getHarnessOrNull(MatButtonHarness);
|
|
73
|
+
const icon = await button.getHarness(MatIconHarness);
|
|
74
|
+
expect(await button.isDisabled()).toBeTrue();
|
|
75
|
+
expect(await icon.getName()).toBe('update');
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
it('should not show any icon when not set', async () => {
|
|
79
|
+
fixture.componentRef.setInput('icon', null);
|
|
80
|
+
|
|
81
|
+
const button = await loader.getHarnessOrNull(MatButtonHarness);
|
|
82
|
+
const icon = await button.getHarnessOrNull(MatIconHarness);
|
|
83
|
+
expect(icon).toBe(null);
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
it('should emit buttonClick event when clicked', async () => {
|
|
87
|
+
const clickSpy = spyOn(component.buttonClick, 'emit');
|
|
88
|
+
const button = await loader.getHarness(MatButtonHarness);
|
|
89
|
+
|
|
90
|
+
await button.click();
|
|
91
|
+
|
|
92
|
+
expect(clickSpy).toHaveBeenCalled();
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
it('should add small-button class when small is set', () => {
|
|
96
|
+
fixture.componentRef.setInput('small', false);
|
|
97
|
+
|
|
98
|
+
fixture.detectChanges();
|
|
99
|
+
|
|
100
|
+
expect(fixture.nativeElement.querySelector('button')).not.toHaveClass('small-button');
|
|
101
|
+
|
|
102
|
+
fixture.componentRef.setInput('small', true);
|
|
103
|
+
|
|
104
|
+
fixture.detectChanges();
|
|
105
|
+
|
|
106
|
+
expect(fixture.nativeElement.querySelector('button')).toHaveClass('small-button');
|
|
107
|
+
});
|
|
108
|
+
});
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { ChangeDetectionStrategy, Component } from '@angular/core';
|
|
2
|
+
import { MatButton, } from '@angular/material/button';
|
|
3
|
+
import { MatIconModule } from '@angular/material/icon';
|
|
4
|
+
import { TranslateModule } from '@ngx-translate/core';
|
|
5
|
+
import { BaseButtonWithLabel } from '../base-button';
|
|
6
|
+
import { NgClass } from '@angular/common';
|
|
7
|
+
|
|
8
|
+
@Component({
|
|
9
|
+
selector: 'cauca-raised-button',
|
|
10
|
+
standalone: true,
|
|
11
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
12
|
+
imports: [MatButton, MatIconModule, TranslateModule, NgClass],
|
|
13
|
+
templateUrl: './raised-button.component.html',
|
|
14
|
+
styleUrl: './raised-button.component.scss',
|
|
15
|
+
})
|
|
16
|
+
export class RaisedButtonComponent extends BaseButtonWithLabel {
|
|
17
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<cauca-button class="refresh-button" icon="refresh" type="stroked" color="primary" (buttonClick)="refresh()" [label]="'refresh' | translate" />
|
|
File without changes
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
2
|
+
import { TranslatePipe } from '@ngx-translate/core';
|
|
3
|
+
import { MockComponent, MockPipe, ngMocks } from 'ng-mocks';
|
|
4
|
+
import { RefreshButtonComponent } from './refresh-button.component';
|
|
5
|
+
import { ButtonComponent } from '../../button/button.component';
|
|
6
|
+
|
|
7
|
+
describe('RefreshButtonComponent', () => {
|
|
8
|
+
let component: RefreshButtonComponent;
|
|
9
|
+
let fixture: ComponentFixture<RefreshButtonComponent>;
|
|
10
|
+
|
|
11
|
+
beforeEach(async () => {
|
|
12
|
+
await TestBed.configureTestingModule({
|
|
13
|
+
imports: [RefreshButtonComponent]
|
|
14
|
+
})
|
|
15
|
+
.overrideComponent(RefreshButtonComponent, {
|
|
16
|
+
remove: { imports: [ButtonComponent, TranslatePipe] },
|
|
17
|
+
add: { imports: [MockComponent(ButtonComponent), MockPipe(TranslatePipe, value => value)] }
|
|
18
|
+
})
|
|
19
|
+
.compileComponents();
|
|
20
|
+
|
|
21
|
+
fixture = TestBed.createComponent(RefreshButtonComponent);
|
|
22
|
+
component = fixture.componentInstance;
|
|
23
|
+
fixture.detectChanges();
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
it('should create', () => {
|
|
27
|
+
expect(component).toBeTruthy();
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
it('should have correct button properties', () => {
|
|
31
|
+
const buttonDebugElement = ngMocks.find(fixture, 'cauca-button')?.componentInstance;
|
|
32
|
+
|
|
33
|
+
expect(buttonDebugElement).toBeDefined();
|
|
34
|
+
expect(buttonDebugElement.type).toBe('stroked');
|
|
35
|
+
expect(buttonDebugElement.icon).toBe('refresh');
|
|
36
|
+
expect(buttonDebugElement.label).toBe('refresh');
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
it('should emit refreshEvent when refresh method is called', () => {
|
|
40
|
+
spyOn(component.refreshEvent, 'emit');
|
|
41
|
+
|
|
42
|
+
component.refresh();
|
|
43
|
+
|
|
44
|
+
expect(component.refreshEvent.emit).toHaveBeenCalledWith();
|
|
45
|
+
expect(component.refreshEvent.emit).toHaveBeenCalledTimes(1);
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
it('should call refresh method when button is clicked', () => {
|
|
49
|
+
spyOn(component, 'refresh');
|
|
50
|
+
const buttonElement = ngMocks.find(fixture, ButtonComponent);
|
|
51
|
+
|
|
52
|
+
ngMocks.trigger(buttonElement, 'buttonClick');
|
|
53
|
+
|
|
54
|
+
expect(component.refresh).toHaveBeenCalledWith();
|
|
55
|
+
expect(component.refresh).toHaveBeenCalledTimes(1);
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
it('should emit refreshEvent when button is clicked', () => {
|
|
59
|
+
spyOn(component.refreshEvent, 'emit');
|
|
60
|
+
const buttonElement = ngMocks.find(fixture, ButtonComponent);
|
|
61
|
+
|
|
62
|
+
ngMocks.trigger(buttonElement, 'buttonClick');
|
|
63
|
+
|
|
64
|
+
expect(component.refreshEvent.emit).toHaveBeenCalledWith();
|
|
65
|
+
expect(component.refreshEvent.emit).toHaveBeenCalledTimes(1);
|
|
66
|
+
}); it('should render cauca-button with expected template', () => {
|
|
67
|
+
const buttonDebugElement = ngMocks.find(fixture, 'cauca-button');
|
|
68
|
+
|
|
69
|
+
// Check that the button component is rendered
|
|
70
|
+
expect(buttonDebugElement).toBeDefined();
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
it('should have EventEmitter as refreshEvent', () => {
|
|
74
|
+
expect(component.refreshEvent).toBeDefined();
|
|
75
|
+
expect(component.refreshEvent.constructor.name).toContain('EventEmitter');
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
it('should initialize with default values', () => {
|
|
79
|
+
expect(component.refreshEvent).toBeDefined();
|
|
80
|
+
});
|
|
81
|
+
});
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Component, ChangeDetectionStrategy, EventEmitter, Output, Input } from '@angular/core';
|
|
2
|
+
import { ButtonComponent } from '../../button/button.component';
|
|
3
|
+
import { TranslatePipe } from '@ngx-translate/core';
|
|
4
|
+
|
|
5
|
+
@Component({
|
|
6
|
+
selector: 'cauca-refresh-button',
|
|
7
|
+
imports: [ButtonComponent, TranslatePipe],
|
|
8
|
+
templateUrl: './refresh-button.component.html',
|
|
9
|
+
styleUrl: './refresh-button.component.scss',
|
|
10
|
+
changeDetection: ChangeDetectionStrategy.OnPush
|
|
11
|
+
})
|
|
12
|
+
export class RefreshButtonComponent {
|
|
13
|
+
@Input() public inProgress: boolean = false;
|
|
14
|
+
@Output() public refreshEvent: EventEmitter<void> = new EventEmitter<void>();
|
|
15
|
+
|
|
16
|
+
public refresh(): void {
|
|
17
|
+
this.refreshEvent.emit();
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
button {
|
|
2
|
+
border-radius: 100px;
|
|
3
|
+
background-color: inherit;
|
|
4
|
+
outline: none;
|
|
5
|
+
border-width: 0px;
|
|
6
|
+
height: 40px;
|
|
7
|
+
width: 40px;
|
|
8
|
+
cursor: pointer;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
:host {
|
|
12
|
+
display: flex;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.mdc-button.mat-white,
|
|
16
|
+
.mat-stroked-button.mat-white {
|
|
17
|
+
color: white;
|
|
18
|
+
border-color: white;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.mdc-button.mat-white:hover,
|
|
22
|
+
.mat-mdc-outlined-button.mat-white:hover {
|
|
23
|
+
background-color: transparent;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
mat-icon {
|
|
27
|
+
color: #006496;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.mat-mdc-button-disabled {
|
|
31
|
+
.mat-icon {
|
|
32
|
+
color: rgba(18, 16, 20, 0.38);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
2
|
+
|
|
3
|
+
import { RoundButtonComponent } from './round-button.component';
|
|
4
|
+
import { MockModule, MockPipe } from 'ng-mocks';
|
|
5
|
+
import { TranslateModule, TranslatePipe } from '@ngx-translate/core';
|
|
6
|
+
|
|
7
|
+
describe('RoundButtonComponent', () => {
|
|
8
|
+
let component: RoundButtonComponent;
|
|
9
|
+
let fixture: ComponentFixture<RoundButtonComponent>;
|
|
10
|
+
|
|
11
|
+
beforeEach(async () => {
|
|
12
|
+
await TestBed.configureTestingModule({
|
|
13
|
+
imports: [RoundButtonComponent, MockModule(TranslateModule)],
|
|
14
|
+
declarations: [MockPipe(TranslatePipe, key => key)]
|
|
15
|
+
})
|
|
16
|
+
.compileComponents();
|
|
17
|
+
|
|
18
|
+
fixture = TestBed.createComponent(RoundButtonComponent);
|
|
19
|
+
component = fixture.componentInstance;
|
|
20
|
+
fixture.detectChanges();
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
it('should create', () => {
|
|
24
|
+
expect(component).toBeTruthy();
|
|
25
|
+
});
|
|
26
|
+
});
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ChangeDetectionStrategy, Component } from '@angular/core';
|
|
2
|
+
import { BaseButtonWithLabel } from '../base-button';
|
|
3
|
+
import { TranslateModule } from '@ngx-translate/core';
|
|
4
|
+
|
|
5
|
+
@Component({
|
|
6
|
+
selector: 'cauca-round-button',
|
|
7
|
+
standalone: true,
|
|
8
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
9
|
+
imports: [TranslateModule],
|
|
10
|
+
templateUrl: './round-button.component.html',
|
|
11
|
+
styleUrl: './round-button.component.scss'
|
|
12
|
+
})
|
|
13
|
+
export class RoundButtonComponent extends BaseButtonWithLabel {
|
|
14
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
<button mat-stroked-button [ngClass]="small() ? 'small-button' : ''" [color]="color()" onclick="this.blur()" [disabled]="buttonDisabled()" (click)="buttonClick.emit()" [class.icon-only]="!label()">
|
|
2
|
+
@if(showIcon() && iconAlignment() === 'left') { <mat-icon [class.button-spin]="isInProgress()">{{iconToShow()}}</mat-icon> }
|
|
3
|
+
@if (label()) { @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,23 @@
|
|
|
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
|
+
|
|
11
|
+
.icon-only {
|
|
12
|
+
width: 36px;
|
|
13
|
+
height: 36px;
|
|
14
|
+
min-width: 38px;
|
|
15
|
+
padding: 0px;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.icon-only mat-icon {
|
|
19
|
+
margin: 0;
|
|
20
|
+
}
|
|
21
|
+
mat-icon {
|
|
22
|
+
color: inherit;
|
|
23
|
+
}
|