diff --git a/src/lib/tabs/tab-nav-bar/tab-nav-bar.spec.ts b/src/lib/tabs/tab-nav-bar/tab-nav-bar.spec.ts index 4a06ea192c1..b37e6a3fe71 100644 --- a/src/lib/tabs/tab-nav-bar/tab-nav-bar.spec.ts +++ b/src/lib/tabs/tab-nav-bar/tab-nav-bar.spec.ts @@ -97,20 +97,29 @@ describe('MatTabNavBar', () => { .toBe(true, 'Expected aria-disabled to be set to "true" if link is disabled.'); }); - it('should update the disableRipple property on each tab link', () => { - const tabLinkElements = fixture.debugElement.queryAll(By.directive(MatTabLink)) - .map(tabLinkDebug => tabLinkDebug.componentInstance) as MatTabLink[]; - - expect(tabLinkElements.every(tabLink => !tabLink.disableRipple)) + it('should disable the ripples on all tabs when they are disabled on the nav bar', () => { + expect(fixture.componentInstance.tabLinks.toArray().every(tabLink => !tabLink.rippleDisabled)) .toBe(true, 'Expected every tab link to have ripples enabled'); - fixture.componentInstance.disableRipple = true; + fixture.componentInstance.disableRippleOnBar = true; fixture.detectChanges(); - expect(tabLinkElements.every(tabLink => tabLink.disableRipple)) + expect(fixture.componentInstance.tabLinks.toArray().every(tabLink => tabLink.rippleDisabled)) .toBe(true, 'Expected every tab link to have ripples disabled'); }); + it('should have the `disableRipple` from the tab take precendence over the nav bar', () => { + const firstTab = fixture.componentInstance.tabLinks.first; + + expect(firstTab.rippleDisabled).toBe(false, 'Expected ripples to be enabled on first tab'); + + firstTab.disableRipple = true; + fixture.componentInstance.disableRippleOnBar = false; + fixture.detectChanges(); + + expect(firstTab.rippleDisabled).toBe(true, 'Expected ripples to be disabled on first tab'); + }); + it('should update the tabindex if links are disabled', () => { const tabLinkElements = fixture.debugElement.queryAll(By.css('a')) .map(tabLinkDebugEl => tabLinkDebugEl.nativeElement); @@ -219,7 +228,7 @@ describe('MatTabNavBar', () => { spyOn(inkBar, 'hide'); - fixture.componentInstance.links.forEach(link => link.active = false); + fixture.componentInstance.tabLinks.forEach(link => link.active = false); fixture.detectChanges(); expect(inkBar.hide).toHaveBeenCalled(); @@ -269,7 +278,7 @@ describe('MatTabNavBar', () => { @Component({ selector: 'test-app', template: ` -