@@ -515,7 +515,7 @@ describe('Carousel', () => {
515515 } ) ;
516516
517517 describe ( 'Templates Tests: ' , ( ) => {
518- it ( 'verify that template can be defined in the markup' , ( ) => {
518+ it ( 'verify that templates can be defined in the markup' , ( ) => {
519519 fixture = TestBed . createComponent ( CarouselTemplateSetInMarkupTestComponent ) ;
520520 carousel = fixture . componentInstance . carousel ;
521521 fixture . detectChanges ( ) ;
@@ -526,9 +526,15 @@ describe('Carousel', () => {
526526 const indicator = HelperTestFunctions . getIndicators ( fixture ) [ index ] as HTMLElement ;
527527 expect ( indicator . innerText ) . toEqual ( index . toString ( ) ) ;
528528 }
529+
530+ expect ( HelperTestFunctions . getNextButtonArrow ( fixture ) ) . toBeNull ( ) ;
531+ expect ( HelperTestFunctions . getPreviousButtonArrow ( fixture ) ) . toBeNull ( ) ;
532+
533+ expect ( HelperTestFunctions . getNextButton ( fixture ) . innerText ) . toEqual ( 'next' ) ;
534+ expect ( HelperTestFunctions . getPreviousButton ( fixture ) . innerText ) . toEqual ( 'prev' ) ;
529535 } ) ;
530536
531- it ( 'verify that template can be changed' , ( ) => {
537+ it ( 'verify that templates can be changed' , ( ) => {
532538 fixture = TestBed . createComponent ( CarouselTemplateSetInTypescriptTestComponent ) ;
533539 carousel = fixture . componentInstance . carousel ;
534540 fixture . detectChanges ( ) ;
@@ -538,8 +544,12 @@ describe('Carousel', () => {
538544
539545 expect ( HelperTestFunctions . getIndicators ( fixture ) . length ) . toBe ( 4 ) ;
540546 expect ( HelperTestFunctions . getIndicatorsDots ( fixture ) . length ) . toBe ( 4 ) ;
547+ expect ( HelperTestFunctions . getNextButtonArrow ( fixture ) ) . toBeDefined ( ) ;
548+ expect ( HelperTestFunctions . getPreviousButtonArrow ( fixture ) ) . toBeDefined ( ) ;
541549
542550 carousel . indicatorTemplate = fixture . componentInstance . customIndicatorTemplate1 ;
551+ carousel . nextButtonTemplate = fixture . componentInstance . customNextTemplate ;
552+ carousel . prevButtonTemplate = fixture . componentInstance . customPrevTemplate ;
543553 fixture . detectChanges ( ) ;
544554
545555 expect ( HelperTestFunctions . getIndicators ( fixture ) . length ) . toBe ( 4 ) ;
@@ -548,6 +558,11 @@ describe('Carousel', () => {
548558 const indicator = HelperTestFunctions . getIndicators ( fixture ) [ index ] as HTMLElement ;
549559 expect ( indicator . innerText ) . toEqual ( index . toString ( ) ) ;
550560 }
561+ expect ( HelperTestFunctions . getNextButtonArrow ( fixture ) ) . toBeNull ( ) ;
562+ expect ( HelperTestFunctions . getPreviousButtonArrow ( fixture ) ) . toBeNull ( ) ;
563+
564+ expect ( HelperTestFunctions . getNextButton ( fixture ) . innerText ) . toEqual ( 'next' ) ;
565+ expect ( HelperTestFunctions . getPreviousButton ( fixture ) . innerText ) . toEqual ( 'prev' ) ;
551566
552567 carousel . indicatorTemplate = fixture . componentInstance . customIndicatorTemplate2 ;
553568 fixture . detectChanges ( ) ;
@@ -565,10 +580,14 @@ describe('Carousel', () => {
565580 }
566581
567582 carousel . indicatorTemplate = null ;
583+ carousel . nextButtonTemplate = null ;
584+ carousel . prevButtonTemplate = null ;
568585 fixture . detectChanges ( ) ;
569586
570587 expect ( HelperTestFunctions . getIndicators ( fixture ) . length ) . toBe ( 4 ) ;
571588 expect ( HelperTestFunctions . getIndicatorsDots ( fixture ) . length ) . toBe ( 4 ) ;
589+ expect ( HelperTestFunctions . getNextButtonArrow ( fixture ) ) . toBeDefined ( ) ;
590+ expect ( HelperTestFunctions . getPreviousButtonArrow ( fixture ) ) . toBeDefined ( ) ;
572591 } ) ;
573592 } ) ;
574593
@@ -704,8 +723,8 @@ describe('Carousel', () => {
704723 expect ( carousel . total ) . toEqual ( 0 ) ;
705724 expect ( HelperTestFunctions . getIndicatorsContainer ( fixture ) ) . toBeNull ( ) ;
706725 expect ( HelperTestFunctions . getIndicatorsContainer ( fixture , CarouselIndicatorsOrientation . top ) ) . toBeNull ( ) ;
707- expect ( HelperTestFunctions . getNextButton ( fixture ) . hidden ) . toBeTruthy ( ) ;
708- expect ( HelperTestFunctions . getPreviousButton ( fixture ) . hidden ) . toBeTruthy ( ) ;
726+ expect ( HelperTestFunctions . getNextButton ( fixture ) ) . toBeNull ( ) ;
727+ expect ( HelperTestFunctions . getPreviousButton ( fixture ) ) . toBeNull ( ) ;
709728
710729 // add a slide
711730 fixture . componentInstance . addSlides ( ) ;
@@ -724,6 +743,7 @@ describe('Carousel', () => {
724743class HelperTestFunctions {
725744 public static NEXT_BUTTON_CLASS = '.igx-carousel__arrow--next' ;
726745 public static PRIV_BUTTON_CLASS = '.igx-carousel__arrow--prev' ;
746+ public static BUTTON_ARROW_CLASS = '.igx-nav-arrow' ;
727747 public static ACTIVE_SLIDE_CLASS = 'igx-slide--current' ;
728748 public static PREVIOUS_SLIDE_CLASS = 'igx-slide--previous' ;
729749 public static INDICATORS_TOP_CLASS = '.igx-carousel-indicators--top' ;
@@ -741,6 +761,16 @@ class HelperTestFunctions {
741761 return fixture . nativeElement . querySelector ( HelperTestFunctions . PRIV_BUTTON_CLASS ) ;
742762 }
743763
764+ public static getNextButtonArrow ( fixture ) : HTMLElement {
765+ const next = HelperTestFunctions . getNextButton ( fixture ) ;
766+ return next . querySelector ( HelperTestFunctions . BUTTON_ARROW_CLASS ) ;
767+ }
768+
769+ public static getPreviousButtonArrow ( fixture ) : HTMLElement {
770+ const prev = HelperTestFunctions . getPreviousButton ( fixture ) ;
771+ return prev . querySelector ( HelperTestFunctions . BUTTON_ARROW_CLASS ) ;
772+ }
773+
744774 public static getIndicatorsContainer ( fixture , position = CarouselIndicatorsOrientation . bottom ) : HTMLElement {
745775 const carouselNative = fixture . nativeElement ;
746776 if ( position === CarouselIndicatorsOrientation . bottom ) {
@@ -819,6 +849,14 @@ class CarouselAnimationsComponent {
819849 <ng-template igxCarouselIndicator let-slide>
820850 <span> {{slide.index}} </span>
821851 </ng-template>
852+
853+ <ng-template igxCarouselNextButton>
854+ <span>next</span>
855+ </ng-template>
856+
857+ <ng-template igxCarouselPrevButton>
858+ <span>prev</span>
859+ </ng-template>
822860 </igx-carousel>
823861 `
824862} )
@@ -837,6 +875,14 @@ class CarouselTemplateSetInMarkupTestComponent {
837875 <span *ngIf="slide.active"> {{slide.index}}: Active </span>
838876 </ng-template>
839877
878+ <ng-template #customNextTemplate>
879+ <span>next</span>
880+ </ng-template>
881+
882+ <ng-template #customPrevTemplate>
883+ <span>prev</span>
884+ </ng-template>
885+
840886 <igx-carousel #carousel [animationType]="'none'">
841887 <igx-slide><h3>Slide1</h3></igx-slide>
842888 <igx-slide><h3>Slide2</h3></igx-slide>
@@ -851,6 +897,10 @@ class CarouselTemplateSetInTypescriptTestComponent {
851897 public customIndicatorTemplate1 ;
852898 @ViewChild ( 'customIndicatorTemplate2' , { read : TemplateRef , static : false } )
853899 public customIndicatorTemplate2 ;
900+ @ViewChild ( 'customNextTemplate' , { read : TemplateRef , static : false } )
901+ public customNextTemplate ;
902+ @ViewChild ( 'customPrevTemplate' , { read : TemplateRef , static : false } )
903+ public customPrevTemplate ;
854904}
855905
856906@Component ( {
0 commit comments