From 9e1ee2f5be93aedc4ac4525f011a422a4ec7d325 Mon Sep 17 00:00:00 2001 From: Kristiyan Kostadinov Date: Fri, 31 Jan 2025 08:33:23 -0800 Subject: [PATCH] test(material/chips): remove unnecessary animations test Removes a test checking the chips with the animations module. I believe this is something we inherited from the legacy chips, but it's not really relevant anymore. --- src/material/chips/chip-grid.spec.ts | 51 +--------------------------- 1 file changed, 1 insertion(+), 50 deletions(-) diff --git a/src/material/chips/chip-grid.spec.ts b/src/material/chips/chip-grid.spec.ts index a4a67b84961b..6865f4e49565 100644 --- a/src/material/chips/chip-grid.spec.ts +++ b/src/material/chips/chip-grid.spec.ts @@ -1,4 +1,3 @@ -import {animate, style, transition, trigger} from '@angular/animations'; import {Direction, Directionality} from '@angular/cdk/bidi'; import { BACKSPACE, @@ -122,9 +121,7 @@ describe('MatChipGrid', () => { }); describe('focus behaviors', () => { - let fixture: - | ComponentFixture - | ComponentFixture; + let fixture: ComponentFixture; beforeEach(() => { fixture = createComponent(StandardChipGrid); @@ -232,23 +229,6 @@ describe('MatChipGrid', () => { expect(chipGridInstance.focus).toHaveBeenCalled(); }); - - it('should move focus to the last chip when the focused chip was deleted inside a component with animations', fakeAsync(() => { - fixture.destroy(); - TestBed.resetTestingModule(); - - fixture = createComponent(StandardChipGridWithAnimations, BrowserAnimationsModule); - - patchElementFocus(chips.last.primaryAction!._elementRef.nativeElement); - chips.last.focus(); - fixture.detectChanges(); - - dispatchKeyboardEvent(chips.last._elementRef.nativeElement, 'keydown', BACKSPACE); - fixture.detectChanges(); - tick(500); - - expect(document.activeElement).toBe(primaryActions[primaryActions.length - 2]); - })); }); it('should have a focus indicator', () => { @@ -1218,35 +1198,6 @@ class ChipGridWithFormErrorMessages { } } -@Component({ - template: ` - - @for (i of numbers; track i) { - {{i}} - } - - `, - animations: [ - // For the case we're testing this animation doesn't - // have to be used anywhere, it just has to be defined. - trigger('dummyAnimation', [ - transition(':leave', [style({opacity: 0}), animate('500ms', style({opacity: 1}))]), - ]), - ], - standalone: false, -}) -class StandardChipGridWithAnimations { - numbers = [0, 1, 2, 3, 4]; - - remove(item: number): void { - const index = this.numbers.indexOf(item); - - if (index > -1) { - this.numbers.splice(index, 1); - } - } -} - @Component({ template: `