Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: Remove MockNgZone #28775

Merged
merged 1 commit into from Mar 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
37 changes: 0 additions & 37 deletions src/cdk/testing/private/mock-ng-zone.ts

This file was deleted.

3 changes: 1 addition & 2 deletions src/cdk/testing/private/public-api.ts
Expand Up @@ -6,9 +6,8 @@
* found in the LICENSE file at https://angular.io/license
*/

export * from './wrapped-error-message';
export * from './mock-ng-zone';
export * from './text-dedent';
export * from './wrapped-error-message';

// Re-exported for convenience.
export * from '../testbed/fake-events';
14 changes: 3 additions & 11 deletions src/material/chips/chip-grid.spec.ts
Expand Up @@ -15,21 +15,19 @@ import {
import {
dispatchFakeEvent,
dispatchKeyboardEvent,
MockNgZone,
patchElementFocus,
typeInElement,
} from '@angular/cdk/testing/private';
import {
Component,
DebugElement,
NgZone,
EventEmitter,
QueryList,
Type,
ViewChild,
ViewChildren,
EventEmitter,
} from '@angular/core';
import {ComponentFixture, fakeAsync, flush, TestBed, tick} from '@angular/core/testing';
import {ComponentFixture, TestBed, fakeAsync, flush, tick} from '@angular/core/testing';
import {FormControl, FormsModule, NgForm, ReactiveFormsModule, Validators} from '@angular/forms';
import {MatFormFieldModule} from '@angular/material/form-field';
import {MatInputModule} from '@angular/material/input';
Expand All @@ -42,7 +40,6 @@ describe('MDC-based MatChipGrid', () => {
let chipGridNativeElement: HTMLElement;
let chipGridInstance: MatChipGrid;
let chips: QueryList<MatChipRow>;
let zone: MockNgZone;
let testComponent: StandardChipGrid;
let directionality: {value: Direction; change: EventEmitter<Direction>};
let primaryActions: NodeListOf<HTMLElement>;
Expand Down Expand Up @@ -194,7 +191,6 @@ describe('MDC-based MatChipGrid', () => {
midItem.focus();
(document.activeElement as HTMLElement).blur();
tick();
zone.simulateZoneExit();

// Destroy the middle item
testComponent.chips.splice(2, 1);
Expand Down Expand Up @@ -720,7 +716,6 @@ describe('MDC-based MatChipGrid', () => {
firstAction.blur();
fixture.detectChanges();
fixture.detectChanges();
zone.simulateZoneExit();
fixture.detectChanges();
flush();

Expand Down Expand Up @@ -1007,10 +1002,7 @@ describe('MDC-based MatChipGrid', () => {
MatInputModule,
animationsModule,
],
providers: [
{provide: NgZone, useFactory: () => (zone = new MockNgZone())},
{provide: Directionality, useValue: directionality},
],
providers: [{provide: Directionality, useValue: directionality}],
declarations: [component],
}).compileComponents();

Expand Down
13 changes: 3 additions & 10 deletions src/material/chips/chip-listbox.spec.ts
Expand Up @@ -3,20 +3,18 @@ import {END, HOME, LEFT_ARROW, RIGHT_ARROW, SPACE, TAB} from '@angular/cdk/keyco
import {
dispatchFakeEvent,
dispatchKeyboardEvent,
MockNgZone,
patchElementFocus,
} from '@angular/cdk/testing/private';
import {
Component,
DebugElement,
NgZone,
EventEmitter,
QueryList,
Type,
ViewChild,
ViewChildren,
EventEmitter,
} from '@angular/core';
import {ComponentFixture, fakeAsync, flush, TestBed, tick} from '@angular/core/testing';
import {ComponentFixture, TestBed, fakeAsync, flush, tick} from '@angular/core/testing';
import {FormControl, FormsModule, ReactiveFormsModule} from '@angular/forms';
import {By} from '@angular/platform-browser';
import {MatChipListbox, MatChipOption, MatChipsModule} from './index';
Expand All @@ -28,7 +26,6 @@ describe('MDC-based MatChipListbox', () => {
let chipListboxInstance: MatChipListbox;
let testComponent: StandardChipListbox;
let chips: QueryList<MatChipOption>;
let zone: MockNgZone;
let directionality: {value: Direction; change: EventEmitter<Direction>};
let primaryActions: NodeListOf<HTMLElement>;

Expand Down Expand Up @@ -223,7 +220,6 @@ describe('MDC-based MatChipListbox', () => {
midItem.focus();
(document.activeElement as HTMLElement).blur();
tick();
zone.simulateZoneExit();

// Destroy the middle item
testComponent.chips.splice(2, 1);
Expand Down Expand Up @@ -850,10 +846,7 @@ describe('MDC-based MatChipListbox', () => {

TestBed.configureTestingModule({
imports: [FormsModule, ReactiveFormsModule, MatChipsModule],
providers: [
{provide: NgZone, useFactory: () => (zone = new MockNgZone())},
{provide: Directionality, useValue: directionality},
],
providers: [{provide: Directionality, useValue: directionality}],
declarations: [component],
}).compileComponents();

Expand Down
9 changes: 0 additions & 9 deletions tslint.json
Expand Up @@ -165,15 +165,6 @@
"**/*.spec.ts",
// TODO(mmalerba): following files to be cleaned up and removed from this list:
"**/cdk/a11y/focus-trap/focus-trap.ts",
"**/cdk/drag-drop/directives/drag.ts",
"**/cdk/overlay/overlay-ref.ts",
"**/cdk/table/coalesced-style-scheduler.ts",
"**/cdk/table/table.ts",
"**/material/autocomplete/autocomplete-trigger.ts",
"**/material/chips/chip.ts",
"**/material/form-field/form-field.ts",
"**/material/menu/menu.ts",
"**/material/sidenav/drawer.ts",
"**/material/tabs/paginated-tab-header.ts"
]
]
Expand Down