Skip to content

Commit e11509e

Browse files
crisbetojosephperrott
authored andcommitted
chore(select): fix flaky positioning test (angular#12496)
Fixes a flaky test that is failing on iOS.
1 parent 8cbe812 commit e11509e

File tree

3 files changed

+6
-10
lines changed

3 files changed

+6
-10
lines changed

src/lib/button/button.spec.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ describe('MatButton', () => {
118118
});
119119

120120
it('should disable the native button element', () => {
121-
let fixture = TestBed.createComponent(TestApp);
121+
const fixture = TestBed.createComponent(TestApp);
122122
let buttonNativeElement = fixture.nativeElement.querySelector('button');
123123
expect(buttonNativeElement.disabled).toBeFalsy('Expected button not to be disabled');
124124

@@ -275,9 +275,9 @@ describe('MatButton', () => {
275275
`
276276
})
277277
class TestApp {
278-
clickCount: number = 0;
278+
clickCount = 0;
279279
isDisabled: boolean = false;
280-
rippleDisabled: boolean = false;
280+
rippleDisabled = false;
281281
buttonColor: ThemePalette;
282282
tabIndex: number;
283283

src/lib/button/button.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,6 @@ import {ANIMATION_MODULE_TYPE} from '@angular/platform-browser/animations';
3333
/** Default color palette for round buttons (mat-fab and mat-mini-fab) */
3434
const DEFAULT_ROUND_BUTTON_COLOR = 'accent';
3535

36-
/** Default color palette for flat buttons (mat-flat-button) */
37-
const DEFAULT_FLAT_BUTTON_COLOR = 'primary';
38-
3936
/**
4037
* List of classes to add to MatButton instances based on host attributes to
4138
* style as different variants.
@@ -113,8 +110,6 @@ export class MatButton extends _MatButtonMixinBase
113110

114111
if (this.isRoundButton) {
115112
this.color = DEFAULT_ROUND_BUTTON_COLOR;
116-
} else if (this._hasHostAttributes('mat-flat-button')) {
117-
this.color = DEFAULT_FLAT_BUTTON_COLOR;
118113
}
119114
}
120115

src/lib/select/select.spec.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3318,7 +3318,8 @@ describe('MatSelect', () => {
33183318

33193319
let panelLeft = document.querySelector('.mat-select-panel')!.getBoundingClientRect().left;
33203320

3321-
expect(panelLeft).toBeGreaterThan(0, `Expected select panel to be inside the viewport.`);
3321+
expect(panelLeft)
3322+
.toBeGreaterThanOrEqual(0, `Expected select panel to be inside the viewport.`);
33223323

33233324
fixture.componentInstance.select.close();
33243325
fixture.detectChanges();
@@ -3330,7 +3331,7 @@ describe('MatSelect', () => {
33303331

33313332
panelLeft = document.querySelector('.mat-select-panel')!.getBoundingClientRect().left;
33323333

3333-
expect(panelLeft).toBeGreaterThan(0,
3334+
expect(panelLeft).toBeGreaterThanOrEqual(0,
33343335
`Expected select panel continue being inside the viewport.`);
33353336
}));
33363337
});

0 commit comments

Comments
 (0)