Skip to content

Commit 75f838f

Browse files
committed
responding to comments
1 parent 3067f8b commit 75f838f

File tree

3 files changed

+14
-12
lines changed

3 files changed

+14
-12
lines changed

src/lib/tabs/tab-body.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<div class="md-tab-body-content"
2-
[@position]="_position"
3-
(@position.start)="_onAnimationStarted($event)"
4-
(@position.done)="_onAnimationComplete($event)">
2+
[@translateTab]="_position"
3+
(@translateTab.start)="_onTranslateTabStarted($event)"
4+
(@translateTab.done)="_onTranslateTabComplete($event)">
55
<template portalHost></template>
66
</div>

src/lib/tabs/tab-group.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ describe('MdTabGroup', () => {
142142

143143
it('should update tab positions and attach content when selected', fakeAsync(() => {
144144
fixture.detectChanges();
145-
let tabComponent = fixture.debugElement.query(By.css('md-tab-group')).componentInstance;
145+
const tabComponent = fixture.debugElement.query(By.css('md-tab-group')).componentInstance;
146146
const tabBodyList = fixture.debugElement.queryAll(By.css('md-tab-body'));
147147

148148
// Begin on the second tab

src/lib/tabs/tabs.ts

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ import {
2020
animate,
2121
transition,
2222
AnimationTransitionEvent,
23-
ElementRef, Renderer,
23+
ElementRef,
24+
Renderer,
2425
} from '@angular/core';
2526
import {CommonModule} from '@angular/common';
2627
import {
@@ -30,14 +31,14 @@ import {
3031
LEFT_ARROW,
3132
ENTER,
3233
coerceBooleanProperty,
34+
PortalHostDirective,
3335
} from '../core';
3436
import {MdTabLabel} from './tab-label';
3537
import {MdTabLabelWrapper} from './tab-label-wrapper';
3638
import {MdTabNavBar, MdTabLink} from './tab-nav-bar/tab-nav-bar';
3739
import {MdInkBar} from './ink-bar';
3840
import {Observable} from 'rxjs/Observable';
3941
import 'rxjs/add/operator/map';
40-
import {PortalHostDirective} from '../core/portal/portal-directives';
4142

4243

4344
/** Used to generate unique ID's for each tab component */
@@ -273,7 +274,7 @@ export class MdTabGroup {
273274
* Sets the height of the body wrapper to the height of the activating tab if dynamic
274275
* height property is true.
275276
*/
276-
_setTabBodyWrapperHeight(e: number) {
277+
_setTabBodyWrapperHeight(tabHeight: number): void {
277278
if (!this._dynamicHeight) { return; }
278279

279280
this._renderer.setElementStyle(this._tabBodyWrapper.nativeElement, 'height',
@@ -282,12 +283,13 @@ export class MdTabGroup {
282283
// This conditional forces the browser to paint the height so that
283284
// the animation to the new height can have an origin.
284285
if (this._tabBodyWrapper.nativeElement.offsetHeight) {
285-
this._renderer.setElementStyle(this._tabBodyWrapper.nativeElement, 'height', e + 'px');
286+
this._renderer.setElementStyle(this._tabBodyWrapper.nativeElement, 'height',
287+
tabHeight + 'px');
286288
}
287289
}
288290

289291
/** Removes the height of the tab body wrapper. */
290-
_removeTabBodyWrapperHeight() {
292+
_removeTabBodyWrapperHeight(): void {
291293
this._renderer.setElementStyle(this._tabBodyWrapper.nativeElement, 'height', '');
292294
}
293295
}
@@ -299,7 +301,7 @@ export type MdTabBodyActiveState = 'left' | 'center' | 'right';
299301
selector: 'md-tab-body',
300302
templateUrl: 'tab-body.html',
301303
animations: [
302-
trigger('position', [
304+
trigger('translateTab', [
303305
state('left', style({transform: 'translate3d(-100%, 0, 0)'})),
304306
state('center', style({transform: 'translate3d(0, 0, 0)'})),
305307
state('right', style({transform: 'translate3d(100%, 0, 0)'})),
@@ -342,13 +344,13 @@ export class MdTabBody implements OnInit {
342344
}
343345
}
344346

345-
_onAnimationStarted(e: AnimationTransitionEvent) {
347+
_onTranslateTabStarted(e: AnimationTransitionEvent) {
346348
if (e.fromState != 'void' && e.toState == 'center') {
347349
this.onTabBodyCentering.emit(this._elementRef.nativeElement.clientHeight);
348350
}
349351
}
350352

351-
_onAnimationComplete(e: AnimationTransitionEvent) {
353+
_onTranslateTabComplete(e: AnimationTransitionEvent) {
352354
if ((e.toState == 'left' || e.toState == 'right') && this._position !== 'center') {
353355
// If the end state is that the tab is not centered, then detach the content.
354356
this._portalHost.detach();

0 commit comments

Comments
 (0)