Skip to content
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

fix(tabs): animation error with nested tab groups #4315

Merged
merged 1 commit into from
Apr 28, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/lib/tabs/tab-body.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ export type MdTabBodyOriginState = 'left' | 'right';
},
animations: [
trigger('translateTab', [
state('void', style({transform: 'translate3d(0, 0, 0)'})),
state('left', style({transform: 'translate3d(-100%, 0, 0)'})),
state('left-origin-center', style({transform: 'translate3d(0, 0, 0)'})),
state('right-origin-center', style({transform: 'translate3d(0, 0, 0)'})),
Expand Down
41 changes: 40 additions & 1 deletion src/lib/tabs/tab-group.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {
} from '@angular/core/testing';
import {MdTabGroup, MdTabsModule, MdTabHeaderPosition} from './index';
import {Component, ViewChild} from '@angular/core';
import {NoopAnimationsModule} from '@angular/platform-browser/animations';
import {NoopAnimationsModule, BrowserAnimationsModule} from '@angular/platform-browser/animations';
import {By} from '@angular/platform-browser';
import {Observable} from 'rxjs/Observable';
import {MdTab} from './tab';
Expand Down Expand Up @@ -290,6 +290,26 @@ describe('MdTabGroup', () => {
}
});


describe('nested MdTabGroup with enabled animations', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
imports: [MdTabsModule.forRoot(), BrowserAnimationsModule],
declarations: [NestedTabs]
});

TestBed.compileComponents();
}));

it('should not throw when creating a component with nested tab groups', async(() => {
expect(() => {
let fixture = TestBed.createComponent(NestedTabs);
fixture.detectChanges();
}).not.toThrow();
}));
});


@Component({
template: `
<md-tab-group class="tab-group"
Expand Down Expand Up @@ -443,3 +463,22 @@ class TabGroupWithSimpleApi {
otherContent = 'Apples, grapes';
@ViewChild('legumes') legumes: any;
}


@Component({
selector: 'nested-tabs',
template: `
<md-tab-group>
<md-tab label="One">Tab one content</md-tab>
<md-tab label="Two">
Tab two content
<md-tab-group [dynamicHeight]="true">
<md-tab label="Inner tab one">Inner content one</md-tab>
<md-tab label="Inner tab two">Inner content two</md-tab>
</md-tab-group>
</md-tab>
</md-tab-group>
`,
})
class NestedTabs {}