From fecbbe86e66298e2e834185fe76a72cad53b4e41 Mon Sep 17 00:00:00 2001 From: Kristiyan Kostadinov Date: Thu, 30 Jan 2025 08:24:44 +0100 Subject: [PATCH 1/2] build: remove unused animation definition from docs site Removes an animation definition that wasn't being used anywhere in the docs. --- .../src/app/pages/component-sidenav/component-sidenav.ts | 8 -------- 1 file changed, 8 deletions(-) diff --git a/material.angular.io/src/app/pages/component-sidenav/component-sidenav.ts b/material.angular.io/src/app/pages/component-sidenav/component-sidenav.ts index 132410678283..4999a76e32c3 100644 --- a/material.angular.io/src/app/pages/component-sidenav/component-sidenav.ts +++ b/material.angular.io/src/app/pages/component-sidenav/component-sidenav.ts @@ -9,7 +9,6 @@ import { input, viewChild, } from '@angular/core'; -import {animate, state, style, transition, trigger} from '@angular/animations'; import {CdkAccordionModule} from '@angular/cdk/accordion'; import {BreakpointObserver} from '@angular/cdk/layout'; import {AsyncPipe} from '@angular/common'; @@ -127,13 +126,6 @@ export class ComponentSidenav implements OnInit, OnDestroy { @Component({ selector: 'app-component-nav', templateUrl: './component-nav.html', - animations: [ - trigger('bodyExpansion', [ - state('collapsed', style({height: '0px', display: 'none'})), - state('expanded', style({height: '*', display: 'block'})), - transition('expanded <=> collapsed', animate('225ms cubic-bezier(0.4,0.0,0.2,1)')), - ]), - ], standalone: true, imports: [MatListModule, RouterLinkActive, RouterLink, AsyncPipe], }) From 7033315ed5bd80c5171e84e3cc2d3586aeb787d6 Mon Sep 17 00:00:00 2001 From: Kristiyan Kostadinov Date: Fri, 31 Jan 2025 08:33:23 -0800 Subject: [PATCH 2/2] 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: `