|
1 | | -import {animate, style, transition, trigger} from '@angular/animations'; |
2 | 1 | import {Direction, Directionality} from '@angular/cdk/bidi'; |
3 | 2 | import { |
4 | 3 | BACKSPACE, |
@@ -122,9 +121,7 @@ describe('MatChipGrid', () => { |
122 | 121 | }); |
123 | 122 |
|
124 | 123 | describe('focus behaviors', () => { |
125 | | - let fixture: |
126 | | - | ComponentFixture<StandardChipGrid> |
127 | | - | ComponentFixture<StandardChipGridWithAnimations>; |
| 124 | + let fixture: ComponentFixture<StandardChipGrid>; |
128 | 125 |
|
129 | 126 | beforeEach(() => { |
130 | 127 | fixture = createComponent(StandardChipGrid); |
@@ -232,23 +229,6 @@ describe('MatChipGrid', () => { |
232 | 229 |
|
233 | 230 | expect(chipGridInstance.focus).toHaveBeenCalled(); |
234 | 231 | }); |
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 | | - })); |
252 | 232 | }); |
253 | 233 |
|
254 | 234 | it('should have a focus indicator', () => { |
@@ -1218,35 +1198,6 @@ class ChipGridWithFormErrorMessages { |
1218 | 1198 | } |
1219 | 1199 | } |
1220 | 1200 |
|
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 | | - |
1250 | 1201 | @Component({ |
1251 | 1202 | template: ` |
1252 | 1203 | <mat-form-field> |
|
0 commit comments