Skip to content

Commit b697823

Browse files
authored
chore: add test for @ViewChild in tab content (#1693)
1 parent 3cd6776 commit b697823

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

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

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import {async, fakeAsync, tick, ComponentFixture, TestBed} from '@angular/core/testing';
22
import {MdTabGroup, MdTabsModule} from './tabs';
3-
import {Component} from '@angular/core';
3+
import {Component, ViewChild} from '@angular/core';
44
import {By} from '@angular/platform-browser';
55
import {Observable} from 'rxjs/Observable';
66

@@ -271,6 +271,10 @@ describe('MdTabGroup', () => {
271271
expect(getSelectedLabel(fixture).textContent).toMatch('Chips');
272272
expect(getSelectedContent(fixture).textContent).toMatch('Salt, vinegar');
273273
});
274+
275+
it('should support @ViewChild in the tab content', () => {
276+
expect(fixture.componentInstance.legumes).toBeTruthy();
277+
});
274278
});
275279

276280
/**
@@ -389,10 +393,12 @@ class AsyncTabsTestApp {
389393
<md-tab label="Junk food"> Pizza, fries </md-tab>
390394
<md-tab label="Vegetables"> Broccoli, spinach </md-tab>
391395
<md-tab [label]="otherLabel"> {{otherContent}} </md-tab>
396+
<md-tab label="Legumes"> <p #legumes>Peanuts</p> </md-tab>
392397
</md-tab-group>
393398
`
394399
})
395400
class TabGroupWithSimpleApi {
396401
otherLabel = 'Fruit';
397402
otherContent = 'Apples, grapes';
403+
@ViewChild('legumes') legumes: any;
398404
}

0 commit comments

Comments
 (0)