Skip to content

Commit 021275f

Browse files
Andrei CaleniucAndrei Caleniuc
authored andcommitted
fix: button spinner
1 parent b78179d commit 021275f

File tree

3 files changed

+9
-12
lines changed

3 files changed

+9
-12
lines changed

projects/angular/directives/ui-progress-button/src/ui-progress-button.directive.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ const describeForButtonType = (type: ButtonType) => {
170170
});
171171

172172
it('should cycle from 1 to 100', () => {
173-
const spy = spyOn(progress, '_primaryTransform');
173+
const spy = spyOn(progress, '_getPrimaryBarTransform');
174174

175175
for (let i = 0; i <= 100; i++) {
176176
component.value = i;
@@ -198,7 +198,7 @@ const describeForButtonType = (type: ButtonType) => {
198198
});
199199

200200
it('should cycle from 1 to 100', () => {
201-
const spy = spyOn(progress, '_bufferTransform');
201+
const spy = spyOn(progress, '_getBufferBarFlexBasis');
202202

203203
for (let i = 0; i <= 100; i++) {
204204
component.bufferValue = i;

projects/angular/directives/ui-spinner-button/src/internal/ui-button-progress-spinner.component.scss

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,13 @@ ui-button-progress-spinner {
2828
}
2929

3030
.ui-spinner-button {
31-
/* TODO(mdc-migration): The following rule targets internal classes of button that may no longer apply for the MDC version. */
32-
.mat-button-wrapper {
31+
mat-icon, .mdc-button__label {
3332
transition: $ui-button-progress-opacity-transition;
3433
}
3534
}
3635

3736
.ui-spinner-button-loading {
38-
/* TODO(mdc-migration): The following rule targets internal classes of button that may no longer apply for the MDC version. */
39-
.mat-button-wrapper {
37+
mat-icon, .mdc-button__label {
4038
opacity: 0;
4139
}
4240
}

projects/angular/directives/ui-spinner-button/src/ui-spinner-button.directive.ts

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import {
66
Renderer2,
77
ViewContainerRef,
88
} from '@angular/core';
9-
import { MatButton } from '@angular/material/button';
109
import { MatProgressSpinner } from '@angular/material/progress-spinner';
1110
import { UiLoaderButtonDirective } from '@uipath/angular/directives/internal';
1211

@@ -52,7 +51,6 @@ export class UiSpinnerButtonDirective
5251
spinnerButtonColor: MatProgressSpinner['color'] = 'accent';
5352

5453
constructor(
55-
button: MatButton,
5654
componentFactory: ComponentFactoryResolver,
5755
container: ViewContainerRef,
5856
private _renderer: Renderer2,
@@ -63,10 +61,7 @@ export class UiSpinnerButtonDirective
6361
container,
6462
);
6563

66-
// FIXME: check if this is a round button
67-
// const isRound = button.isIconButton ||
68-
// button.isRoundButton;
69-
const isRound = true;
64+
const isRound = this._hasHostAttributes('mdc-fab', 'mdc-icon-button');
7065

7166
this._loader.isRound$.next(isRound);
7267

@@ -108,4 +103,8 @@ export class UiSpinnerButtonDirective
108103

109104
this._loader.loading$.next(this.spinnerButtonLoading);
110105
};
106+
107+
private _hasHostAttributes(...attributes: string[]) {
108+
return attributes.some(attribute => this._buttonElement.hasAttribute(attribute));
109+
}
111110
}

0 commit comments

Comments
 (0)