diff --git a/lib/core/info-drawer/info-drawer.component.html b/lib/core/info-drawer/info-drawer.component.html index d42bf89de9..8006c2fdd4 100644 --- a/lib/core/info-drawer/info-drawer.component.html +++ b/lib/core/info-drawer/info-drawer.component.html @@ -7,7 +7,7 @@ - + diff --git a/lib/core/info-drawer/info-drawer.component.spec.ts b/lib/core/info-drawer/info-drawer.component.spec.ts index 4d28b94a10..8c3c594b93 100644 --- a/lib/core/info-drawer/info-drawer.component.spec.ts +++ b/lib/core/info-drawer/info-drawer.component.spec.ts @@ -17,6 +17,7 @@ import { Component } from '@angular/core'; import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { MatTabChangeEvent } from '@angular/material'; import { By } from '@angular/platform-browser'; import { MaterialModule } from '../material.module'; import { InfoDrawerLayoutComponent } from './info-drawer-layout.component'; @@ -57,9 +58,8 @@ describe('InfoDrawerComponent', () => { it('should emit when tab is changed', () => { let tabEmitSpy = spyOn(component.currentTab, 'emit'); let event = {index: 1, tab: {textLabel: 'DETAILS'}}; - component.onTabChange(event); - expect(tabEmitSpy).toHaveBeenCalled(); - expect(tabEmitSpy).toHaveBeenCalledWith('DETAILS'); + component.onTabChange( event); + expect(tabEmitSpy).toHaveBeenCalledWith(1); }); it('should render the title', () => { diff --git a/lib/core/info-drawer/info-drawer.component.ts b/lib/core/info-drawer/info-drawer.component.ts index 458ae32584..4af5a8ab79 100644 --- a/lib/core/info-drawer/info-drawer.component.ts +++ b/lib/core/info-drawer/info-drawer.component.ts @@ -16,6 +16,7 @@ */ import { Component, ContentChildren, EventEmitter, Input, Output, QueryList, TemplateRef, ViewChild, ViewEncapsulation } from '@angular/core'; +import { MatTabChangeEvent } from '@angular/material'; @Component({ selector: 'adf-info-drawer-tab', template: '' @@ -37,7 +38,7 @@ export class InfoDrawerComponent { title: string|null = null; @Output() - currentTab: EventEmitter = new EventEmitter(); + currentTab: EventEmitter = new EventEmitter(); @ContentChildren(InfoDrawerTabComponent) contentBlocks: QueryList; @@ -46,8 +47,7 @@ export class InfoDrawerComponent { return this.contentBlocks.length > 0; } - onTabChange(event: any) { - const tab = event.tab; - this.currentTab.emit(tab.textLabel); + onTabChange(event: MatTabChangeEvent) { + this.currentTab.emit(event.index); } }