diff --git a/angular.json b/angular.json index a62eb80c..3ac5b911 100644 --- a/angular.json +++ b/angular.json @@ -21,9 +21,6 @@ "outputPath": "dist/ppwcode", "index": "src/index.html", "browser": "src/main.ts", - "polyfills": [ - "zone.js" - ], "tsConfig": "tsconfig.app.json", "inlineStyleLanguage": "scss", "assets": [ @@ -85,10 +82,6 @@ "builder": "@angular/build:karma", "options": { "karmaConfig": "karma.conf.js", - "polyfills": [ - "zone.js", - "zone.js/testing" - ], "tsConfig": "tsconfig.spec.json", "inlineStyleLanguage": "scss", "assets": [ @@ -139,10 +132,6 @@ "options": { "karmaConfig": "karma.conf.js", "tsConfig": "projects/ppwcode/ng-async/tsconfig.spec.json", - "polyfills": [ - "zone.js", - "zone.js/testing" - ] } }, "lint": { @@ -182,10 +171,6 @@ "options": { "karmaConfig": "karma.conf.js", "tsConfig": "projects/ppwcode/ng-common/tsconfig.spec.json", - "polyfills": [ - "zone.js", - "zone.js/testing" - ] } }, "lint": { @@ -225,10 +210,6 @@ "options": { "karmaConfig": "karma.conf.js", "tsConfig": "projects/ppwcode/ng-utils/tsconfig.spec.json", - "polyfills": [ - "zone.js", - "zone.js/testing" - ] } }, "lint": { @@ -268,10 +249,6 @@ "options": { "karmaConfig": "karma.conf.js", "tsConfig": "projects/ppwcode/ng-wireframe/tsconfig.spec.json", - "polyfills": [ - "zone.js", - "zone.js/testing" - ] } }, "lint": { @@ -311,10 +288,6 @@ "options": { "karmaConfig": "karma.conf.js", "tsConfig": "projects/ppwcode/ng-router/tsconfig.spec.json", - "polyfills": [ - "zone.js", - "zone.js/testing" - ] } }, "lint": { @@ -354,10 +327,6 @@ "options": { "karmaConfig": "karma.conf.js", "tsConfig": "projects/ppwcode/ng-state-management/tsconfig.spec.json", - "polyfills": [ - "zone.js", - "zone.js/testing" - ] } }, "lint": { @@ -397,10 +366,6 @@ "options": { "karmaConfig": "karma.conf.js", "tsConfig": "projects/ppwcode/ng-dialogs/tsconfig.spec.json", - "polyfills": [ - "zone.js", - "zone.js/testing" - ] } }, "lint": { @@ -440,10 +405,6 @@ "options": { "karmaConfig": "karma.conf.js", "tsConfig": "projects/ppwcode/ng-forms/tsconfig.spec.json", - "polyfills": [ - "zone.js", - "zone.js/testing" - ] } }, "lint": { @@ -483,10 +444,6 @@ "options": { "karmaConfig": "karma.conf.js", "tsConfig": "projects/ppwcode/ng-common-components/tsconfig.spec.json", - "polyfills": [ - "zone.js", - "zone.js/testing" - ] } } } @@ -517,10 +474,6 @@ "options": { "karmaConfig": "karma.conf.js", "tsConfig": "projects/ppwcode/ng-unit-testing/tsconfig.spec.json", - "polyfills": [ - "zone.js", - "zone.js/testing" - ] } } } diff --git a/package-lock.json b/package-lock.json index 172af0b3..e89023e0 100644 --- a/package-lock.json +++ b/package-lock.json @@ -25,8 +25,7 @@ "file-saver-es": "2.0.5", "luxon": "3.7.1", "rxjs": "7.8.1", - "tslib": "2.8.1", - "zone.js": "0.15.0" + "tslib": "2.8.1" }, "devDependencies": { "@angular-eslint/builder": "21.0.1", @@ -13924,13 +13923,6 @@ "peerDependencies": { "zod": "^3.25 || ^4" } - }, - "node_modules/zone.js": { - "version": "0.15.0", - "resolved": "https://registry.npmjs.org/zone.js/-/zone.js-0.15.0.tgz", - "integrity": "sha512-9oxn0IIjbCZkJ67L+LkhYWRyAy7axphb3VgE2MBDlOqnmHMPWGYMxJxBYFueFq/JGY2GMwS0rU+UCLunEmy5UA==", - "license": "MIT", - "peer": true } } } diff --git a/package.json b/package.json index 2fa9930e..8ab5e359 100644 --- a/package.json +++ b/package.json @@ -37,8 +37,7 @@ "file-saver-es": "2.0.5", "luxon": "3.7.1", "rxjs": "7.8.1", - "tslib": "2.8.1", - "zone.js": "0.15.0" + "tslib": "2.8.1" }, "devDependencies": { "@angular-eslint/builder": "21.0.1", diff --git a/projects/ppwcode/ng-common-components/src/lib/table/cells/template-cell/template-cell.component.spec.ts b/projects/ppwcode/ng-common-components/src/lib/table/cells/template-cell/template-cell.component.spec.ts index 2ffab530..01f919dd 100644 --- a/projects/ppwcode/ng-common-components/src/lib/table/cells/template-cell/template-cell.component.spec.ts +++ b/projects/ppwcode/ng-common-components/src/lib/table/cells/template-cell/template-cell.component.spec.ts @@ -1,10 +1,10 @@ -import { Component } from '@angular/core' +import { ChangeDetectionStrategy, Component, signal, WritableSignal } from '@angular/core' import { ComponentFixture, TestBed } from '@angular/core/testing' import { By } from '@angular/platform-browser' import { PpwTableModule } from '../../table.module' @Component({ - template: ` + template: ` Row id: {{ row.id }} @@ -12,10 +12,11 @@ import { PpwTableModule } from '../../table.module' `, - imports: [PpwTableModule] + imports: [PpwTableModule], + changeDetection: ChangeDetectionStrategy.OnPush }) class TemplateCellHostComponent { - public data: Array<{ id: number }> = [{ id: 128 }, { id: 129 }] + public data: WritableSignal> = signal([{ id: 128 }, { id: 129 }]) public readonly trackBy = (_index: number, item: { id: number }): number => item.id } @@ -51,7 +52,9 @@ describe('TemplateCellComponent', () => { expect(rowIndexSpans[1].nativeElement.textContent).toBe('Row index: 1') // Switch data order to simulate a drag and drop reorder - component.data = [component.data[1], component.data[0]] + component.data.update((data) => { + return [data[1], data[0]] + }) fixture.detectChanges() const updatedRowIdSpans = fixture.debugElement.queryAll(By.css('.row-id')) diff --git a/projects/ppwcode/ng-common-components/src/lib/table/table.component.spec.ts b/projects/ppwcode/ng-common-components/src/lib/table/table.component.spec.ts index 85cac98a..8f243a50 100644 --- a/projects/ppwcode/ng-common-components/src/lib/table/table.component.spec.ts +++ b/projects/ppwcode/ng-common-components/src/lib/table/table.component.spec.ts @@ -1,4 +1,4 @@ -import { Component, ViewChild } from '@angular/core' +import { ChangeDetectionStrategy, Component, signal, ViewChild, WritableSignal } from '@angular/core' import { ComponentFixture, TestBed } from '@angular/core/testing' import { NoopAnimationsModule } from '@angular/platform-browser/animations' import { ColumnType } from './columns/column' @@ -93,8 +93,8 @@ export function getJsDateFormatter(): (value: Date) => string { @Component({ template: ` - - @for (column of columns; track column) { + + @for (column of columns(); track column) { string { } `, - standalone: false + standalone: false, + changeDetection: ChangeDetectionStrategy.OnPush }) class TestTableComponent { @ViewChild(TableComponent, { static: true }) tableComponent!: TableComponent - public columns: Array<{ - name: string - label: string - type: ColumnType - valueRetrieval?: string | ((record: PeriodicElement) => unknown) - dateFormatter?: (value: PeriodicElement) => string - disableSortClear?: boolean - }> = [ + public columns: WritableSignal< + Array<{ + name: string + label: string + type: ColumnType + valueRetrieval?: string | ((record: PeriodicElement) => unknown) + dateFormatter?: (value: PeriodicElement) => string + disableSortClear?: boolean + }> + > = signal([ { name: 'elementName', label: 'Element name', type: ColumnType.Text, valueRetrieval: 'name' }, { name: 'symbol', label: 'Symbol', type: ColumnType.Text } - ] - public data: Array = MOCK_ELEMENT_DATA + ]) + public data: WritableSignal> = signal(MOCK_ELEMENT_DATA) public trackBy = (index: number, record: PeriodicElement) => record.position } @@ -138,7 +141,7 @@ describe('TableComponent', () => { }) fixture = TestBed.createComponent(TestTableComponent) - fixture.componentInstance.data = [...MOCK_ELEMENT_DATA] + fixture.componentInstance.data.set([...MOCK_ELEMENT_DATA]) tableComponent = (fixture.componentInstance as TestTableComponent).tableComponent fixture.detectChanges() }) @@ -150,14 +153,21 @@ describe('TableComponent', () => { expect(tableComponent.dataSource().data[3].mappedValues['symbol']).toBe('Be') }) - it('should detect column changes', () => { - fixture.componentInstance.columns[1] = { - name: 'testName', - label: 'testLabel', - type: ColumnType.Text, - valueRetrieval: 'symbol' - } - fixture.detectChanges() + it('should detect column changes', async () => { + fixture.componentInstance.columns.update((cols) => { + const [firstColumn, , ...restColumns] = cols + return [ + firstColumn, + { + name: 'testName', + label: 'testLabel', + type: ColumnType.Text, + valueRetrieval: 'symbol' + }, + ...restColumns + ] + }) + await fixture.whenStable() expect(tableComponent.columnNames()[1]).toBe('testName') expect(tableComponent.dataSource().data[3].mappedValues['symbol']).toBe(undefined) @@ -172,170 +182,215 @@ describe('TableComponent', () => { position: 11, jsDate: new Date(2024, 10, 1) } - const newData = [...fixture.componentInstance.data, testObj] - fixture.componentInstance.data = newData + const newData = [...fixture.componentInstance.data(), testObj] + fixture.componentInstance.data.set(newData) fixture.detectChanges() expect(tableComponent.dataSource().data[10].initialRecord).toBe(testObj) }) - it('should map undefined text column property', () => { - fixture.componentInstance.columns.push({ name: 'weight', label: 'Weight', type: ColumnType.Text }) - fixture.componentInstance.columns.push({ - name: 'weightFromUndefinedProp', - label: 'Weight', - type: ColumnType.Text + it('should map undefined text column property', async () => { + fixture.componentInstance.columns.update((cols) => { + return [ + ...cols, + { name: 'weight', label: 'Weight', type: ColumnType.Text }, + { + name: 'weightFromUndefinedProp', + label: 'Weight', + type: ColumnType.Text + } + ] }) - fixture.detectChanges() + await fixture.whenStable() expect(tableComponent.columnNames()).toEqual(['elementName', 'symbol', 'weight', 'weightFromUndefinedProp']) expect(tableComponent.dataSource().data[3].mappedValues['weight']).toBe(9.0122) expect(tableComponent.dataSource().data[3].mappedValues['weightFromUndefinedProp']).toBe(undefined) }) - it('should map string text column property', () => { - fixture.componentInstance.columns.push({ - name: 'weight', - label: 'Weight', - type: ColumnType.Text, - valueRetrieval: 'string' - }) - fixture.componentInstance.columns.push({ - name: 'weightFromProp', - label: 'Weight', - type: ColumnType.Text, - valueRetrieval: 'weight' + it('should map string text column property', async () => { + fixture.componentInstance.columns.update((cols) => { + return [ + ...cols, + { + name: 'weight', + label: 'Weight', + type: ColumnType.Text, + valueRetrieval: 'string' + }, + { + name: 'weightFromProp', + label: 'Weight', + type: ColumnType.Text, + valueRetrieval: 'weight' + } + ] }) - fixture.detectChanges() + await fixture.whenStable() expect(tableComponent.columnNames()).toEqual(['elementName', 'symbol', 'weight', 'weightFromProp']) expect(tableComponent.dataSource().data[3].mappedValues['weight']).toBe(undefined) expect(tableComponent.dataSource().data[3].mappedValues['weightFromProp']).toBe(9.0122) }) - it('should map function text column property', () => { - fixture.componentInstance.columns.push({ - name: 'weight', - label: 'Weight', - type: ColumnType.Text, - valueRetrieval: (record: PeriodicElement) => record.weight.toFixed(2) + it('should map function text column property', async () => { + fixture.componentInstance.columns.update((cols) => { + return [ + ...cols, + { + name: 'weight', + label: 'Weight', + type: ColumnType.Text, + valueRetrieval: (record: PeriodicElement) => record.weight.toFixed(2) + } + ] }) - fixture.detectChanges() + await fixture.whenStable() expect(tableComponent.columnNames()).toEqual(['elementName', 'symbol', 'weight']) expect(tableComponent.dataSource().data[3].mappedValues['weight']).toBe('9.01') }) - it('should map undefined number column property', () => { - fixture.componentInstance.columns.push({ - name: 'weight', - label: 'Weight', - type: ColumnType.Number + it('should map undefined number column property', async () => { + fixture.componentInstance.columns.update((cols) => { + return [ + ...cols, + { + name: 'weight', + label: 'Weight', + type: ColumnType.Number + }, + { + name: 'weightFromUndefinedProp', + label: 'Weight', + type: ColumnType.Number + } + ] }) - fixture.componentInstance.columns.push({ - name: 'weightFromUndefinedProp', - label: 'Weight', - type: ColumnType.Number - }) - fixture.detectChanges() + await fixture.whenStable() expect(tableComponent.columnNames()).toEqual(['elementName', 'symbol', 'weight', 'weightFromUndefinedProp']) expect(tableComponent.dataSource().data[3].mappedValues['weight']).toBe(9.0122) expect(tableComponent.dataSource().data[3].mappedValues['weightFromUndefinedProp']).toBe(undefined) }) - it('should map string number column property', () => { - fixture.componentInstance.columns.push({ - name: 'weight', - label: 'Weight', - type: ColumnType.Number, - valueRetrieval: 'number' + it('should map string number column property', async () => { + fixture.componentInstance.columns.update((cols) => { + return [ + ...cols, + { + name: 'weight', + label: 'Weight', + type: ColumnType.Number, + valueRetrieval: 'number' + }, + { + name: 'weightFromProp', + label: 'Weight', + type: ColumnType.Number, + valueRetrieval: 'weight' + } + ] }) - fixture.componentInstance.columns.push({ - name: 'weightFromProp', - label: 'Weight', - type: ColumnType.Number, - valueRetrieval: 'weight' - }) - fixture.detectChanges() + await fixture.whenStable() expect(tableComponent.columnNames()).toEqual(['elementName', 'symbol', 'weight', 'weightFromProp']) expect(tableComponent.dataSource().data[3].mappedValues['weight']).toBe(undefined) expect(tableComponent.dataSource().data[3].mappedValues['weightFromProp']).toBe(9.0122) }) - it('should map function number column property', () => { - fixture.componentInstance.columns.push({ - name: 'weight', - label: 'Weight', - type: ColumnType.Number, - valueRetrieval: (record: PeriodicElement) => Number(record.weight.toFixed(2)) + it('should map function number column property', async () => { + fixture.componentInstance.columns.update((cols) => { + return [ + ...cols, + { + name: 'weight', + label: 'Weight', + type: ColumnType.Number, + valueRetrieval: (record: PeriodicElement) => Number(record.weight.toFixed(2)) + } + ] }) - fixture.detectChanges() + await fixture.whenStable() expect(tableComponent.columnNames()).toEqual(['elementName', 'symbol', 'weight']) expect(tableComponent.dataSource().data[3].mappedValues['weight']).toBe(9.01) }) - it('should map undefined js date column property', () => { - fixture.componentInstance.columns.push({ - name: 'jsDate', - label: 'jsTestDate', - type: ColumnType.Date, - dateFormatter: getJsDateFormatter() as (value: unknown) => string - }) - fixture.componentInstance.columns.push({ - name: 'jsDateFromUndefinedProp', - label: 'jsTestDate', - type: ColumnType.Date, - dateFormatter: getJsDateFormatter() as (value: unknown) => string + it('should map undefined js date column property', async () => { + fixture.componentInstance.columns.update((cols) => { + return [ + ...cols, + { + name: 'jsDate', + label: 'jsTestDate', + type: ColumnType.Date, + dateFormatter: getJsDateFormatter() as (value: unknown) => string + }, + { + name: 'jsDateFromUndefinedProp', + label: 'jsTestDate', + type: ColumnType.Date, + dateFormatter: getJsDateFormatter() as (value: unknown) => string + } + ] }) - fixture.detectChanges() + await fixture.whenStable() expect(tableComponent.columnNames()).toEqual(['elementName', 'symbol', 'jsDate', 'jsDateFromUndefinedProp']) expect(tableComponent.dataSource().data[3].mappedValues['jsDate']).toBe('Sat Apr 01 2023') expect(tableComponent.dataSource().data[3].mappedValues['jsDateFromUndefinedProp']).toBe(undefined) }) - it('should map string js date column property', () => { - fixture.componentInstance.columns.push({ - name: 'jsDate', - label: 'jsDate', - type: ColumnType.Date, - dateFormatter: getJsDateFormatter() as (value: unknown) => string, - valueRetrieval: 'date' - }) - fixture.componentInstance.columns.push({ - name: 'jsDateFromProp', - label: 'jsDateFromProp', - type: ColumnType.Date, - dateFormatter: getJsDateFormatter() as (value: unknown) => string, - valueRetrieval: 'jsDate' + it('should map string js date column property', async () => { + fixture.componentInstance.columns.update((cols) => { + return [ + ...cols, + { + name: 'jsDate', + label: 'jsDate', + type: ColumnType.Date, + dateFormatter: getJsDateFormatter() as (value: unknown) => string, + valueRetrieval: 'date' + }, + { + name: 'jsDateFromProp', + label: 'jsDateFromProp', + type: ColumnType.Date, + dateFormatter: getJsDateFormatter() as (value: unknown) => string, + valueRetrieval: 'jsDate' + } + ] }) - fixture.detectChanges() + await fixture.whenStable() expect(tableComponent.columnNames()).toEqual(['elementName', 'symbol', 'jsDate', 'jsDateFromProp']) expect(tableComponent.dataSource().data[3].mappedValues['jsDate']).toBe(undefined) expect(tableComponent.dataSource().data[3].mappedValues['jsDateFromProp']).toBe('Sat Apr 01 2023') }) - it('should map function js date column property', () => { - fixture.componentInstance.columns.push({ - name: 'jsDate', - label: 'jsDate', - type: ColumnType.Date, - dateFormatter: getJsDateFormatter() as (value: unknown) => string, - valueRetrieval: (record: PeriodicElement) => - new Date( - record.jsDate.getFullYear(), - record.jsDate.getMonth() + 4, - record.jsDate.getDate(), - record.jsDate.getHours(), - record.jsDate.getMinutes(), - record.jsDate.getSeconds() - ) + it('should map function js date column property', async () => { + fixture.componentInstance.columns.update((cols) => { + return [ + ...cols, + { + name: 'jsDate', + label: 'jsDate', + type: ColumnType.Date, + dateFormatter: getJsDateFormatter() as (value: unknown) => string, + valueRetrieval: (record: PeriodicElement) => + new Date( + record.jsDate.getFullYear(), + record.jsDate.getMonth() + 4, + record.jsDate.getDate(), + record.jsDate.getHours(), + record.jsDate.getMinutes(), + record.jsDate.getSeconds() + ) + } + ] }) - fixture.detectChanges() + await fixture.whenStable() expect(tableComponent.columnNames()).toEqual(['elementName', 'symbol', 'jsDate']) expect(tableComponent.dataSource().data[3].mappedValues['jsDate']).toBe('Tue Aug 01 2023') diff --git a/projects/ppwcode/ng-common/src/lib/mixins/handle-subscriptions.spec.ts b/projects/ppwcode/ng-common/src/lib/mixins/handle-subscriptions.spec.ts index 9b40ab27..b0ef4d7f 100644 --- a/projects/ppwcode/ng-common/src/lib/mixins/handle-subscriptions.spec.ts +++ b/projects/ppwcode/ng-common/src/lib/mixins/handle-subscriptions.spec.ts @@ -1,5 +1,5 @@ import { ChangeDetectionStrategy, Component } from '@angular/core' -import { ComponentFixture, fakeAsync, TestBed, tick } from '@angular/core/testing' +import { ComponentFixture, TestBed } from '@angular/core/testing' import { interval } from 'rxjs' import { mixinHandleSubscriptions } from './handle-subscriptions' @@ -8,6 +8,9 @@ describe('Handle subscriptions mixin', () => { let component: TestComponent beforeEach(() => { + jasmine.clock().install() + jasmine.clock().mockDate(new Date()) + TestBed.configureTestingModule({ declarations: [TestComponent] }) @@ -16,29 +19,33 @@ describe('Handle subscriptions mixin', () => { component = fixture.componentInstance }) + afterEach(() => { + jasmine.clock().uninstall() + }) + it('should extend the given class definitions', () => { expect(component.stopOnDestroy).toBeDefined() }) - it('should stop listening to the stream when the class is destroyed', fakeAsync(() => { + it('should stop listening to the stream when the class is destroyed', () => { const interval$ = interval(1000) let subscriptionHits = 0 const subscription = component.stopOnDestroy(interval$).subscribe(() => subscriptionHits++) expect(subscriptionHits).toBe(0) - tick(999) + jasmine.clock().tick(999) expect(subscriptionHits).toBe(0) - tick(2) + jasmine.clock().tick(2) expect(subscriptionHits).toBe(1) fixture.destroy() - tick(1000) + jasmine.clock().tick(1000) expect(subscriptionHits).toBe(1) subscription.unsubscribe() - })) + }) }) @Component({ diff --git a/projects/ppwcode/ng-common/src/lib/mixins/track-pending.spec.ts b/projects/ppwcode/ng-common/src/lib/mixins/track-pending.spec.ts index 8d93027b..ce39794b 100644 --- a/projects/ppwcode/ng-common/src/lib/mixins/track-pending.spec.ts +++ b/projects/ppwcode/ng-common/src/lib/mixins/track-pending.spec.ts @@ -1,4 +1,3 @@ -import { fakeAsync, tick } from '@angular/core/testing' import { delay, firstValueFrom, of } from 'rxjs' import { CanTrackPending, CanTrackPendingCtor, mixinTrackPending } from './track-pending' @@ -11,10 +10,17 @@ describe('Track pending mixin', () => { let instanceOfExtendedClass: BaseClass & CanTrackPending beforeEach(() => { + jasmine.clock().install() + jasmine.clock().mockDate(new Date()) + extendedClass = mixinTrackPending(false, BaseClass) instanceOfExtendedClass = new extendedClass() }) + afterEach(() => { + jasmine.clock().uninstall() + }) + it('should extend the base implementation', () => { expect(instanceOfExtendedClass.pending$).toBeDefined() expect(instanceOfExtendedClass.startPending).toBeDefined() @@ -23,7 +29,7 @@ describe('Track pending mixin', () => { expect(instanceOfExtendedClass.isPending).toBeDefined() }) - it('should track the pending state of a single stream', fakeAsync(async () => { + it('should track the pending state of a single stream', async () => { const stream$ = of('value').pipe(delay(100)) const trackedStream$ = instanceOfExtendedClass.trackPending(stream$) @@ -32,14 +38,14 @@ describe('Track pending mixin', () => { expect(await firstValueFrom(instanceOfExtendedClass.pending$)).toBeTrue() expect(await firstValueFrom(instanceOfExtendedClass.isPending())).toBeTrue() - tick(100) + jasmine.clock().tick(100) expect(await firstValueFrom(instanceOfExtendedClass.pending$)).toBeFalse() expect(await firstValueFrom(instanceOfExtendedClass.isPending())).toBeFalse() subscription.unsubscribe() - })) + }) - it('should track the pending state of multiple streams by name', fakeAsync(async () => { + it('should track the pending state of multiple streams by name', async () => { const stream1$ = of('value').pipe(delay(100)) const stream2$ = of('value').pipe(delay(100)) @@ -52,15 +58,15 @@ describe('Track pending mixin', () => { expect(await firstValueFrom(instanceOfExtendedClass.isPending('stream1'))).toBeTrue() expect(await firstValueFrom(instanceOfExtendedClass.isPending('stream2'))).toBeTrue() - tick(100) + jasmine.clock().tick(100) expect(await firstValueFrom(instanceOfExtendedClass.isPending('stream1'))).toBeFalse() expect(await firstValueFrom(instanceOfExtendedClass.isPending('stream2'))).toBeFalse() subscription1.unsubscribe() subscription2.unsubscribe() - })) + }) - it('should track the pending state of unnamed and named streams', fakeAsync(async () => { + it('should track the pending state of unnamed and named streams', async () => { const stream$ = of('value').pipe(delay(100)) const trackedStream$ = instanceOfExtendedClass.trackPending(stream$) @@ -72,13 +78,13 @@ describe('Track pending mixin', () => { expect(await firstValueFrom(instanceOfExtendedClass.isPending())).toBeTrue() expect(await firstValueFrom(instanceOfExtendedClass.isPending('named'))).toBeTrue() - tick(100) + jasmine.clock().tick(100) expect(await firstValueFrom(instanceOfExtendedClass.isPending())).toBeFalse() expect(await firstValueFrom(instanceOfExtendedClass.isPending('named'))).toBeFalse() subscription.unsubscribe() namedSubscription.unsubscribe() - })) + }) it('should support manual pending tracking on the default name', async () => { const isPending$ = instanceOfExtendedClass.pending$ diff --git a/src/main.ts b/src/main.ts index 6da4ba3e..f22c8fad 100644 --- a/src/main.ts +++ b/src/main.ts @@ -2,7 +2,7 @@ import { registerLocaleData } from '@angular/common' import { provideHttpClient, withInterceptorsFromDi } from '@angular/common/http' import localeEn from '@angular/common/locales/en-BE' import localeNl from '@angular/common/locales/nl-BE' -import { LOCALE_ID, provideZoneChangeDetection } from '@angular/core' +import { LOCALE_ID, provideZonelessChangeDetection } from '@angular/core' import { MAT_DATE_FORMATS, MAT_NATIVE_DATE_FORMATS, MatDateFormats } from '@angular/material/core' import { bootstrapApplication } from '@angular/platform-browser' import { provideRouter, TitleStrategy, withViewTransitions } from '@angular/router' @@ -41,7 +41,7 @@ const translationLocationPrefix = bootstrapApplication(AppComponent, { providers: [ - provideZoneChangeDetection(), + provideZonelessChangeDetection(), { provide: LOCALE_ID, useValue: 'en-US' }, { provide: TitleStrategy, useClass: TranslatedPageTitleStrategy }, { provide: MAT_DATE_FORMATS, useValue: DATE_FORMATS },