Skip to content

Commit 3007547

Browse files
committed
fixup! fixup! feat(material-experimental/mdc-autocomplete): add panel animation
1 parent 72f28d1 commit 3007547

File tree

4 files changed

+13
-12
lines changed

4 files changed

+13
-12
lines changed

src/material-experimental/mdc-autocomplete/animations.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ import {
1515
transition,
1616
trigger
1717
} from '@angular/animations';
18-
import {numbers as menuSurfaceConstants} from '@material/menu-surface';
1918

2019
// Animation values come from
2120
// https://github.com/material-components/material-components-web/blob/master/packages/mdc-menu-surface/_mixins.scss
@@ -28,12 +27,10 @@ export const panelAnimation: AnimationTriggerMetadata = trigger('panelAnimation'
2827
transition(':enter, hidden => visible', [
2928
group([
3029
animate('0.03s linear', style({ opacity: 1 })),
31-
animate(
32-
`${menuSurfaceConstants.TRANSITION_OPEN_DURATION}ms cubic-bezier(0, 0, 0.2, 1)`,
33-
style({ transform: 'scale(1)' })),
30+
animate('0.12s cubic-bezier(0, 0, 0.2, 1)', style({ transform: 'scale(1)' })),
3431
]),
3532
]),
3633
transition(':leave, visible => hidden', [
37-
animate(`${menuSurfaceConstants.TRANSITION_CLOSE_DURATION}ms linear`, style({ opacity: 0 })),
34+
animate('0.075s linear', style({ opacity: 0 })),
3835
]),
3936
]);

src/material-experimental/mdc-autocomplete/autocomplete.spec.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,7 @@ describe('MDC-based MatAutocomplete', () => {
193193
fixture.detectChanges();
194194
zone.simulateZoneExit();
195195
dispatchFakeEvent(document, 'auxclick');
196+
tick();
196197

197198
expect(fixture.componentInstance.trigger.panelOpen)
198199
.toBe(false, `Expected clicking outside the panel to set its state to closed.`);

src/material-experimental/mdc-autocomplete/autocomplete.ts

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,21 +7,20 @@
77
*/
88

99
import {
10-
Component,
11-
ViewEncapsulation,
1210
ChangeDetectionStrategy,
11+
Component,
1312
ContentChildren,
1413
QueryList,
14+
ViewEncapsulation,
1515
} from '@angular/core';
16-
import {panelAnimation} from '@angular/material-experimental/mdc-autocomplete/animations';
17-
import {_MatAutocompleteBase} from '@angular/material/autocomplete';
1816
import {
19-
MAT_OPTION_PARENT_COMPONENT,
2017
MAT_OPTGROUP,
18+
MAT_OPTION_PARENT_COMPONENT,
2119
MatOptgroup,
2220
MatOption,
2321
} from '@angular/material-experimental/mdc-core';
24-
22+
import {_MatAutocompleteBase} from '@angular/material/autocomplete';
23+
import {panelAnimation} from './animations';
2524

2625
@Component({
2726
selector: 'mat-autocomplete',

src/material/autocomplete/testing/shared.spec.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import {Component} from '@angular/core';
55
import {ComponentFixture, inject, TestBed} from '@angular/core/testing';
66
import {MatAutocompleteModule} from '@angular/material/autocomplete';
77
import {MatAutocompleteHarness} from '@angular/material/autocomplete/testing';
8+
import {NoopAnimationsModule} from '@angular/platform-browser/animations';
89

910
/**
1011
* Function that can be used to run the shared autocomplete harness tests for either the non-MDC or
@@ -19,7 +20,10 @@ export function runHarnessTests(
1920

2021
beforeEach(async () => {
2122
await TestBed.configureTestingModule({
22-
imports: [autocompleteModule],
23+
imports: [
24+
NoopAnimationsModule,
25+
autocompleteModule
26+
],
2327
declarations: [AutocompleteHarnessTest],
2428
}).compileComponents();
2529

0 commit comments

Comments
 (0)