-
Notifications
You must be signed in to change notification settings - Fork 6.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(tabs): add animation done event #5238 #6811
Conversation
src/lib/tabs/tab-group.ts
Outdated
@@ -269,5 +272,6 @@ export class MdTabGroup extends _MdTabGroupMixinBase implements AfterContentInit | |||
_removeTabBodyWrapperHeight(): void { | |||
this._tabBodyWrapperHeight = this._tabBodyWrapper.nativeElement.clientHeight; | |||
this._renderer.setStyle(this._tabBodyWrapper.nativeElement, 'height', ''); | |||
this.animationDone.emit(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unit test? Even with NoopAnimationModule
, it should still fire the event
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like the _onTranslateTabComplete
function is getting called in tab-body.ts
, however, the onCentered
event that is captured in tab-group.ts
in the _removeTabBodyWrapperHeight
method is not getting triggered in the tests. Any thoughts?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What kind of flushing / waiting does the test use?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here is the test I've written for this:
fit('should fire animation done event', async (() => {
fixture.detectChanges();
spyOn(fixture.componentInstance, 'animationDone');
let tabLabel = fixture.debugElement.queryAll(By.css('.mat-tab-label'))[1];
tabLabel.nativeElement.click();
fixture.detectChanges();
fixture.whenStable().then(() => {
fixture.detectChanges();
expect(fixture.componentInstance.animationDone).toHaveBeenCalled();
});
}));
@jelbourn Test added :) |
|
@jelbourn - #facepalm - fixed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@amcdnl Please rebase. Thanks! |
@tinayuangao - Done :) |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Addresses #5238 by adding an
animationDone
event that is triggered after the tab body transition has completed.Closes #3032