@@ -61,7 +61,7 @@ describe('PoTabsComponent:', () => {
6161
6262 component [ 'tabsService' ] . triggerActiveOnChanges ( tabMock ) ;
6363
64- expect ( component . onTabActiveByDropdown ) . toHaveBeenCalledWith ( tabMock ) ;
64+ expect ( component . onTabActiveByDropdown ) . toHaveBeenCalledWith ( tabMock , false ) ;
6565 } ) ;
6666
6767 it ( 'ngOnInit: should unsubscribe' , ( ) => {
@@ -518,6 +518,7 @@ describe('PoTabsComponent:', () => {
518518
519519 it ( 'onTabActiveByDropdown: should correctly call methods and update styles when called' , ( ) => {
520520 const tabMock = jasmine . createSpyObj ( 'PoTabComponent' , [ 'id' ] , { id : 'tab-id' } ) ;
521+ tabMock . click = { emit : ( ) => { } } ;
521522 component . defaultLastTabWidth = 100 ;
522523
523524 const nativeElementMock = { style : { width : '' } , getBoundingClientRect : ( ) => ( { width : 100 } ) } ;
@@ -531,10 +532,12 @@ describe('PoTabsComponent:', () => {
531532 component . tabsDefault = [ tabMock ] ;
532533 component . tabsDropdown = [ tabMock ] ;
533534
535+ spyOn ( tabMock . click , 'emit' ) ;
534536 spyOn ( component , 'handleKeyboardNavigationTab' ) ;
535537
536538 component . onTabActiveByDropdown ( tabMock ) ;
537539
540+ expect ( tabMock . click . emit ) . toHaveBeenCalledWith ( tabMock ) ;
538541 expect ( component . tabButton . last . nativeElement . style . width ) . toBe ( '100px' ) ;
539542 expect ( component . handleKeyboardNavigationTab ) . toHaveBeenCalled ( ) ;
540543 expect ( component . tabsDefault . includes ( tabMock ) ) . toBe ( true ) ;
@@ -543,6 +546,7 @@ describe('PoTabsComponent:', () => {
543546
544547 it ( 'reorderTabs: should reorder tabs if tabIndex is not -1' , ( ) => {
545548 const tabMock = jasmine . createSpyObj ( 'PoTabComponent' , [ 'id' ] , { id : 'tab4' , widthButton : '130' } ) ;
549+ tabMock . click = { emit : ( ) => { } } ;
546550 const tabsArrayMock = [
547551 jasmine . createSpyObj ( 'PoTabComponent' , [ 'id' ] , { id : 'tab1' , widthButton : '100' } ) ,
548552 jasmine . createSpyObj ( 'PoTabComponent' , [ 'id' ] , { id : 'tab2' , widthButton : '110' } ) ,
@@ -556,6 +560,7 @@ describe('PoTabsComponent:', () => {
556560
557561 component . quantityTabsButton = 3 ;
558562
563+ spyOn ( tabMock . click , 'emit' ) ;
559564 spyOn ( component , < any > 'changeTabPositionByDropdown' ) . and . callFake ( ( tab : PoTabComponent ) => {
560565 const tabIndex = component . tabsChildren . toArray ( ) . indexOf ( tab ) ;
561566 if ( tabIndex !== - 1 ) {
@@ -572,6 +577,7 @@ describe('PoTabsComponent:', () => {
572577
573578 const reorderedTabs = component . tabsChildren . toArray ( ) ;
574579
580+ expect ( tabMock . click . emit ) . toHaveBeenCalledWith ( tabMock ) ;
575581 expect ( reorderedTabs . map ( tab => tab . id ) ) . toEqual ( [ 'tab1' , 'tab2' , 'tab4' , 'tab3' ] ) ;
576582 expect ( component . tabButton . last . nativeElement . style . width ) . toBe ( '130px' ) ;
577583 } ) ;
0 commit comments