|
1 | 1 | import { AsyncPipe } from '@angular/common'; |
2 | | -import { AfterViewInit, ChangeDetectorRef, Component, DebugElement, ElementRef, Injectable, Injector, OnDestroy, OnInit, ViewChild, inject } from '@angular/core'; |
| 2 | +import { AfterViewInit, ChangeDetectorRef, Component, DebugElement, ElementRef, Injectable, Injector, OnDestroy, OnInit, ViewChild, inject, provideZonelessChangeDetection } from '@angular/core'; |
3 | 3 | import { ComponentFixture, fakeAsync, TestBed, tick, waitForAsync } from '@angular/core/testing'; |
4 | 4 | import { |
5 | 5 | FormsModule, NgForm, NgModel, ReactiveFormsModule, UntypedFormBuilder, UntypedFormControl, UntypedFormGroup, Validators |
@@ -2712,7 +2712,7 @@ describe('igxCombo', () => { |
2712 | 2712 | fixture.detectChanges(); |
2713 | 2713 | expect(combo.dropdown.headers[0].element.nativeElement.innerText).toEqual('New England') |
2714 | 2714 | }); |
2715 | | - it('should sort groups with diacritics correctly', async() => { |
| 2715 | + it('should sort groups with diacritics correctly', async () => { |
2716 | 2716 | combo.data = [ |
2717 | 2717 | { field: "Alaska", region: "Méxícó" }, |
2718 | 2718 | { field: "California", region: "Méxícó" }, |
@@ -3706,6 +3706,65 @@ describe('igxCombo', () => { |
3706 | 3706 | })); |
3707 | 3707 | }); |
3708 | 3708 | }); |
| 3709 | + |
| 3710 | + describe('Zoneless', () => { |
| 3711 | + beforeEach(async () => { |
| 3712 | + await TestBed.configureTestingModule({ |
| 3713 | + imports: [ |
| 3714 | + NoopAnimationsModule, |
| 3715 | + IgxComboComponent, |
| 3716 | + ], |
| 3717 | + providers: [ |
| 3718 | + provideZonelessChangeDetection() |
| 3719 | + ] |
| 3720 | + }).compileComponents(); |
| 3721 | + |
| 3722 | + fixture = TestBed.createComponent(IgxComboSampleComponent); |
| 3723 | + fixture.detectChanges(); |
| 3724 | + combo = fixture.componentInstance.combo; |
| 3725 | + }); |
| 3726 | + |
| 3727 | + it('should not reproduce NG0100 when virtualized combo items update on scroll - issue #17310', async () => { |
| 3728 | + combo.open(); |
| 3729 | + await fixture.whenStable(); |
| 3730 | + |
| 3731 | + const scrollEl = combo.virtualScrollContainer.getScroll(); |
| 3732 | + expect(scrollEl).toBeTruthy(); |
| 3733 | + |
| 3734 | + expect(() => { |
| 3735 | + scrollEl.scrollTop = 300; |
| 3736 | + scrollEl.dispatchEvent(new Event('scroll')); |
| 3737 | + |
| 3738 | + fixture.whenStable(); |
| 3739 | + fixture.detectChanges(); |
| 3740 | + }).not.toThrowError(/NG0100|ExpressionChangedAfterItHasBeenCheckedError/); |
| 3741 | + }); |
| 3742 | + |
| 3743 | + it('should not reproduce NG0100 related to active descendant on scroll - issue #17310', fakeAsync(() => { |
| 3744 | + combo.toggle(); |
| 3745 | + tick(); |
| 3746 | + fixture.detectChanges(); |
| 3747 | + |
| 3748 | + const dropdownContent = fixture.debugElement.query(By.css(`.${CSS_CLASS_CONTENT}`)); |
| 3749 | + dropdownContent.triggerEventHandler('focus', {}); |
| 3750 | + tick(); |
| 3751 | + fixture.detectChanges(); |
| 3752 | + |
| 3753 | + const activeDescendantId = combo.dropdown.activeDescendant; |
| 3754 | + expect(activeDescendantId).toBeTruthy(); |
| 3755 | + |
| 3756 | + fixture.detectChanges(); |
| 3757 | + |
| 3758 | + expect(() => { |
| 3759 | + const scrollEl = combo.virtualScrollContainer.getScroll(); |
| 3760 | + scrollEl.scrollTop = 1000; |
| 3761 | + scrollEl.dispatchEvent(new Event('scroll')); |
| 3762 | + |
| 3763 | + tick(100); |
| 3764 | + fixture.detectChanges(); |
| 3765 | + }).not.toThrowError(/NG0100|ExpressionChangedAfterItHasBeenCheckedError/); |
| 3766 | + })); |
| 3767 | + }); |
3709 | 3768 | }); |
3710 | 3769 | }); |
3711 | 3770 |
|
|
0 commit comments