mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2026-09-09 18:03:21 +00:00
AAE-51237 Fixing tests to pass with zoneless default behaviour of Angular 21
This commit is contained in:
@@ -59,7 +59,7 @@ describe('DropdownBreadcrumb', () => {
|
||||
};
|
||||
|
||||
const clickOnTheFirstOption = () => {
|
||||
const option: any = document.querySelector(`[data-automation-class="dropdown-breadcrumb-path-option"]`);
|
||||
const option: any = fixture.nativeElement.querySelector(`[data-automation-class="dropdown-breadcrumb-path-option"]`);
|
||||
option.click();
|
||||
};
|
||||
|
||||
|
||||
@@ -16,12 +16,12 @@
|
||||
*/
|
||||
|
||||
import { NoopTranslateModule } from '@alfresco/adf-core';
|
||||
import { NgModule } from '@angular/core';
|
||||
import { NgModule, provideZoneChangeDetection } from '@angular/core';
|
||||
import { BrowserTestingModule } from '@angular/platform-browser/testing';
|
||||
import { provideNoopAnimations } from '@angular/platform-browser/animations';
|
||||
|
||||
@NgModule({
|
||||
imports: [BrowserTestingModule, NoopTranslateModule],
|
||||
providers: [provideNoopAnimations()]
|
||||
providers: [provideNoopAnimations(), provideZoneChangeDetection()]
|
||||
})
|
||||
export class GlobalTestingModule {}
|
||||
|
||||
-1
@@ -89,7 +89,6 @@ export class CardViewItemDispatcherComponent implements OnChanges {
|
||||
this.componentReference.instance[changeName] = change.currentValue;
|
||||
});
|
||||
|
||||
// Writing to `.instance` does not mark the view dirty, which zoneless change detection requires.
|
||||
this.componentReference.changeDetectorRef.markForCheck();
|
||||
|
||||
this.proxy('ngOnChanges', changes);
|
||||
|
||||
@@ -766,7 +766,7 @@ describe('DataTable', () => {
|
||||
it('should initialize default adapter', () => {
|
||||
const table = TestBed.createComponent(DataTableComponent).componentInstance;
|
||||
expect(table.data).toBeUndefined();
|
||||
table.ngOnChanges({ data: new SimpleChange('123', {}, true) });
|
||||
table.ngOnChanges({ data: new SimpleChange(null, {}, true) });
|
||||
expect(table.data).toEqual(jasmine.any(ObjectDataTableAdapter));
|
||||
});
|
||||
|
||||
@@ -1023,7 +1023,7 @@ describe('DataTable', () => {
|
||||
|
||||
it('should allow "select all" calls with no rows', () => {
|
||||
dataTable.multiselect = true;
|
||||
dataTable.ngOnChanges({ data: new SimpleChange('123', {}, true) });
|
||||
dataTable.ngOnChanges({ data: new SimpleChange(null, {}, true) });
|
||||
|
||||
dataTable.onSelectAllClick({ checked: true } as MatCheckboxChange);
|
||||
expect(dataTable.isSelectAllChecked).toBe(true);
|
||||
@@ -1053,7 +1053,7 @@ describe('DataTable', () => {
|
||||
const rows = data.getRows();
|
||||
|
||||
dataTable.multiselect = true;
|
||||
dataTable.ngOnChanges({ data: new SimpleChange('123', data, true) });
|
||||
dataTable.ngOnChanges({ data: new SimpleChange(null, data, true) });
|
||||
|
||||
expect(rows[0].isSelected).toBe(false);
|
||||
expect(rows[1].isSelected).toBe(false);
|
||||
@@ -1181,13 +1181,13 @@ describe('DataTable', () => {
|
||||
});
|
||||
|
||||
it('should require adapter sorting to evaluate sorting state', () => {
|
||||
dataTable.ngOnChanges({ data: new SimpleChange('123', {}, true) });
|
||||
dataTable.ngOnChanges({ data: new SimpleChange(null, {}, true) });
|
||||
spyOn(dataTable.data, 'getSorting').and.returnValue(null);
|
||||
expect(dataTable.isColumnSorted({} as DataColumn, 'asc')).toBeFalsy();
|
||||
});
|
||||
|
||||
it('should evaluate column sorting state', () => {
|
||||
dataTable.ngOnChanges({ data: new SimpleChange('123', {}, true) });
|
||||
dataTable.ngOnChanges({ data: new SimpleChange(null, {}, true) });
|
||||
spyOn(dataTable.data, 'getSorting').and.returnValue(new DataSorting('column_1', 'asc'));
|
||||
expect(dataTable.isColumnSorted({ key: 'column_1' } as DataColumn, 'asc')).toBeTruthy();
|
||||
expect(dataTable.isColumnSorted({ key: 'column_2' } as DataColumn, 'desc')).toBeFalsy();
|
||||
@@ -1267,7 +1267,7 @@ describe('DataTable', () => {
|
||||
};
|
||||
|
||||
dataTable.getRowActions(row, column);
|
||||
dataTable.ngOnChanges({ data: new SimpleChange('123', {}, true) });
|
||||
dataTable.ngOnChanges({ data: new SimpleChange(null, {}, true) });
|
||||
dataTable.getRowActions(row, column);
|
||||
|
||||
expect(emitted).toBe(2);
|
||||
|
||||
@@ -16,12 +16,12 @@
|
||||
*/
|
||||
|
||||
import { NoopTranslateModule } from './noop-translate.module';
|
||||
import { NgModule } from '@angular/core';
|
||||
import { NgModule, provideZoneChangeDetection } from '@angular/core';
|
||||
import { BrowserTestingModule } from '@angular/platform-browser/testing';
|
||||
import { provideNoopAnimations } from '@angular/platform-browser/animations';
|
||||
|
||||
@NgModule({
|
||||
imports: [BrowserTestingModule, NoopTranslateModule],
|
||||
providers: [provideNoopAnimations()]
|
||||
providers: [provideNoopAnimations(), provideZoneChangeDetection()]
|
||||
})
|
||||
export class GlobalTestingModule {}
|
||||
|
||||
@@ -20,9 +20,9 @@
|
||||
import 'zone.js';
|
||||
import 'zone.js/testing';
|
||||
import { getTestBed } from '@angular/core/testing';
|
||||
import { BrowserDynamicTestingModule, platformBrowserDynamicTesting } from '@angular/platform-browser-dynamic/testing';
|
||||
import { BrowserTestingModule, platformBrowserTesting } from '@angular/platform-browser/testing';
|
||||
|
||||
// First, initialize the Angular testing environment.
|
||||
getTestBed().initTestEnvironment(BrowserDynamicTestingModule, platformBrowserDynamicTesting(), {
|
||||
getTestBed().initTestEnvironment(BrowserTestingModule, platformBrowserTesting(), {
|
||||
teardown: { destroyAfterEach: true }
|
||||
});
|
||||
|
||||
@@ -19,15 +19,20 @@
|
||||
|
||||
import 'zone.js';
|
||||
import 'zone.js/testing';
|
||||
import { getTestBed } from '@angular/core/testing';
|
||||
import { BrowserDynamicTestingModule, platformBrowserDynamicTesting } from '@angular/platform-browser-dynamic/testing';
|
||||
import { BrowserTestingModule, platformBrowserTesting } from '@angular/platform-browser/testing';
|
||||
import { TestBed, getTestBed } from '@angular/core/testing';
|
||||
import { provideZoneChangeDetection } from '@angular/core';
|
||||
import * as ChartJs from 'chart.js/auto';
|
||||
import Raphael from 'raphael';
|
||||
|
||||
// First, initialize the Angular testing environment.
|
||||
getTestBed().initTestEnvironment(BrowserDynamicTestingModule, platformBrowserDynamicTesting(), {
|
||||
getTestBed().initTestEnvironment(BrowserTestingModule, platformBrowserTesting(), {
|
||||
teardown: { destroyAfterEach: false }
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({ providers: [provideZoneChangeDetection()] });
|
||||
});
|
||||
|
||||
(window as any).Chart = (window as any).Chart || ChartJs.Chart;
|
||||
(window as any).Raphael = (window as any).Raphael || Raphael;
|
||||
|
||||
@@ -17,11 +17,11 @@
|
||||
|
||||
import { BrowserTestingModule } from '@angular/platform-browser/testing';
|
||||
import { NoopTranslateModule } from '@alfresco/adf-core';
|
||||
import { NgModule } from '@angular/core';
|
||||
import { NgModule, provideZoneChangeDetection } from '@angular/core';
|
||||
import { provideNoopAnimations } from '@angular/platform-browser/animations';
|
||||
|
||||
@NgModule({
|
||||
imports: [BrowserTestingModule, NoopTranslateModule],
|
||||
providers: [provideNoopAnimations()]
|
||||
providers: [provideNoopAnimations(), provideZoneChangeDetection()]
|
||||
})
|
||||
export class GlobalTestingModule {}
|
||||
|
||||
@@ -17,11 +17,11 @@
|
||||
|
||||
import { BrowserTestingModule } from '@angular/platform-browser/testing';
|
||||
import { NoopTranslateModule } from '@alfresco/adf-core';
|
||||
import { NgModule } from '@angular/core';
|
||||
import { NgModule, provideZoneChangeDetection } from '@angular/core';
|
||||
import { provideNoopAnimations } from '@angular/platform-browser/animations';
|
||||
|
||||
@NgModule({
|
||||
imports: [BrowserTestingModule, NoopTranslateModule],
|
||||
providers: [provideNoopAnimations()]
|
||||
providers: [provideNoopAnimations(), provideZoneChangeDetection()]
|
||||
})
|
||||
export class GlobalTestingModule {}
|
||||
|
||||
Reference in New Issue
Block a user