Skip to content

Commit 9e1ee2f

Browse files
committed
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.
1 parent 3b86ff7 commit 9e1ee2f

File tree

1 file changed

+1
-50
lines changed

1 file changed

+1
-50
lines changed

src/material/chips/chip-grid.spec.ts

Lines changed: 1 addition & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import {animate, style, transition, trigger} from '@angular/animations';
21
import {Direction, Directionality} from '@angular/cdk/bidi';
32
import {
43
BACKSPACE,
@@ -122,9 +121,7 @@ describe('MatChipGrid', () => {
122121
});
123122

124123
describe('focus behaviors', () => {
125-
let fixture:
126-
| ComponentFixture<StandardChipGrid>
127-
| ComponentFixture<StandardChipGridWithAnimations>;
124+
let fixture: ComponentFixture<StandardChipGrid>;
128125

129126
beforeEach(() => {
130127
fixture = createComponent(StandardChipGrid);
@@ -232,23 +229,6 @@ describe('MatChipGrid', () => {
232229

233230
expect(chipGridInstance.focus).toHaveBeenCalled();
234231
});
235-
236-
it('should move focus to the last chip when the focused chip was deleted inside a component with animations', fakeAsync(() => {
237-
fixture.destroy();
238-
TestBed.resetTestingModule();
239-
240-
fixture = createComponent(StandardChipGridWithAnimations, BrowserAnimationsModule);
241-
242-
patchElementFocus(chips.last.primaryAction!._elementRef.nativeElement);
243-
chips.last.focus();
244-
fixture.detectChanges();
245-
246-
dispatchKeyboardEvent(chips.last._elementRef.nativeElement, 'keydown', BACKSPACE);
247-
fixture.detectChanges();
248-
tick(500);
249-
250-
expect(document.activeElement).toBe(primaryActions[primaryActions.length - 2]);
251-
}));
252232
});
253233

254234
it('should have a focus indicator', () => {
@@ -1218,35 +1198,6 @@ class ChipGridWithFormErrorMessages {
12181198
}
12191199
}
12201200

1221-
@Component({
1222-
template: `
1223-
<mat-chip-grid #chipGrid>
1224-
@for (i of numbers; track i) {
1225-
<mat-chip-row (removed)="remove(i)">{{i}}</mat-chip-row>
1226-
}
1227-
<input name="test" [matChipInputFor]="chipGrid"/>
1228-
</mat-chip-grid>`,
1229-
animations: [
1230-
// For the case we're testing this animation doesn't
1231-
// have to be used anywhere, it just has to be defined.
1232-
trigger('dummyAnimation', [
1233-
transition(':leave', [style({opacity: 0}), animate('500ms', style({opacity: 1}))]),
1234-
]),
1235-
],
1236-
standalone: false,
1237-
})
1238-
class StandardChipGridWithAnimations {
1239-
numbers = [0, 1, 2, 3, 4];
1240-
1241-
remove(item: number): void {
1242-
const index = this.numbers.indexOf(item);
1243-
1244-
if (index > -1) {
1245-
this.numbers.splice(index, 1);
1246-
}
1247-
}
1248-
}
1249-
12501201
@Component({
12511202
template: `
12521203
<mat-form-field>

0 commit comments

Comments
 (0)