Skip to content

Commit 376d3cd

Browse files
andrewseguinmmalerba
authored andcommitted
chore: add ticks
1 parent b36d79d commit 376d3cd

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/material-experimental/mdc-autocomplete/autocomplete.spec.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,7 @@ describe('MDC-based MatAutocomplete', () => {
180180
fixture.detectChanges();
181181
zone.simulateZoneExit();
182182
dispatchFakeEvent(document, 'click');
183+
tick();
183184

184185
expect(fixture.componentInstance.trigger.panelOpen)
185186
.toBe(false, `Expected clicking outside the panel to set its state to closed.`);
@@ -219,6 +220,7 @@ describe('MDC-based MatAutocomplete', () => {
219220
const option = overlayContainerElement.querySelector('mat-option') as HTMLElement;
220221
option.click();
221222
fixture.detectChanges();
223+
tick();
222224

223225
expect(fixture.componentInstance.trigger.panelOpen)
224226
.toBe(false, `Expected clicking an option to set the panel state to closed.`);
@@ -251,25 +253,27 @@ describe('MDC-based MatAutocomplete', () => {
251253
options = overlayContainerElement.querySelectorAll('mat-option') as NodeListOf<HTMLElement>;
252254
options[1].click();
253255
fixture.detectChanges();
256+
tick();
254257

255258
expect(fixture.componentInstance.trigger.panelOpen)
256259
.toBe(false, `Expected clicking a new option to set the panel state to closed.`);
257260
expect(overlayContainerElement.textContent)
258261
.toEqual('', `Expected clicking a new option to close the panel.`);
259262
}));
260263

261-
it('should close the panel programmatically', () => {
264+
it('should close the panel programmatically', fakeAsync(() => {
262265
fixture.componentInstance.trigger.openPanel();
263266
fixture.detectChanges();
264267

265268
fixture.componentInstance.trigger.closePanel();
266269
fixture.detectChanges();
270+
tick();
267271

268272
expect(fixture.componentInstance.trigger.panelOpen)
269273
.toBe(false, `Expected closing programmatically to set the panel state to closed.`);
270274
expect(overlayContainerElement.textContent)
271275
.toEqual('', `Expected closing programmatically to close the panel.`);
272-
});
276+
}));
273277

274278
it('should not throw when attempting to close the panel of a destroyed autocomplete', () => {
275279
const trigger = fixture.componentInstance.trigger;
@@ -1032,6 +1036,7 @@ describe('MDC-based MatAutocomplete', () => {
10321036
flush();
10331037
fixture.componentInstance.trigger._handleKeydown(ENTER_EVENT);
10341038
fixture.detectChanges();
1039+
tick();
10351040

10361041
expect(fixture.componentInstance.trigger.panelOpen)
10371042
.toBe(false, `Expected panel state to read closed after ENTER key.`);
@@ -1248,6 +1253,7 @@ describe('MDC-based MatAutocomplete', () => {
12481253

12491254
dispatchKeyboardEvent(input, 'keydown', TAB);
12501255
fixture.detectChanges();
1256+
tick();
12511257

12521258
expect(overlayContainerElement.querySelector('.mat-mdc-autocomplete-panel'))
12531259
.toBeFalsy('Expected panel to be removed.');

0 commit comments

Comments
 (0)