@@ -440,11 +440,19 @@ describe('Rendering Tests', () => {
440440 it ( 'should place the title in the step element according to the specified titlePosition when stepType is set to "full"' , ( ) => {
441441 stepper . orientation = IgxStepperOrientation . Horizontal ;
442442 stepper . stepType = IgxStepType . Full ;
443+ stepper . titlePosition = null ;
443444 fix . detectChanges ( ) ;
444445
445- let positions = getStepperPositions ( ) ;
446+ //test default title positions
447+ for ( const step of stepper . steps ) {
448+ expect ( step . titlePosition ) . toBe ( stepper . _defaultTitlePosition ) ;
449+ expect ( step . titlePosition ) . toBe ( IgxStepperTitlePosition . Bottom ) ;
450+ expect ( step . nativeElement ) . toHaveClass ( `igx-stepper__step--${ stepper . _defaultTitlePosition } ` ) ;
451+ }
452+
453+ const positions = getStepperPositions ( ) ;
446454 positions . forEach ( ( pos : IgxStepperTitlePosition ) => {
447- stepper . horizontalTitlePosition = pos ;
455+ stepper . titlePosition = pos ;
448456 fix . detectChanges ( ) ;
449457
450458 for ( const step of stepper . steps ) {
@@ -453,11 +461,18 @@ describe('Rendering Tests', () => {
453461 } ) ;
454462
455463 stepper . orientation = IgxStepperOrientation . Vertical ;
464+ stepper . titlePosition = null ;
456465 fix . detectChanges ( ) ;
457466
458- positions = getStepperPositions ( ) ;
467+ //test default title positions
468+ for ( const step of stepper . steps ) {
469+ expect ( step . titlePosition ) . toBe ( stepper . _defaultTitlePosition ) ;
470+ expect ( step . titlePosition ) . toBe ( IgxStepperTitlePosition . End ) ;
471+ expect ( step . nativeElement ) . toHaveClass ( `igx-stepper__step--${ stepper . _defaultTitlePosition } ` ) ;
472+ }
473+
459474 positions . forEach ( ( pos : IgxStepperTitlePosition ) => {
460- stepper . verticalTitlePosition = pos ;
475+ stepper . titlePosition = pos ;
461476 fix . detectChanges ( ) ;
462477
463478 for ( const step of stepper . steps ) {
@@ -544,20 +559,11 @@ describe('Rendering Tests', () => {
544559 testAnimationBehvior ( val , fix , false ) ;
545560 }
546561
547- const dummyTestValues = [ - 1 , 'sampleString' , [ ] , { } ] ;
548-
549- for ( const val of dummyTestValues ) {
550- expect ( ( ) => {
551- fix . componentInstance . animationDuration = val as any ;
552- testAnimationBehvior ( val , fix , false ) ;
553- } ) . toThrow ( ) ;
554- }
555-
556- const fallbackToDefaultValues = [ 0 , null ] ;
562+ const fallbackToDefaultValues = [ - 1 , 0 , null , undefined , 'sampleString' , [ ] , { } ] ;
557563 for ( const val of fallbackToDefaultValues ) {
558564 fix . componentInstance . animationDuration = val as any ;
559565 fix . detectChanges ( ) ;
560- expect ( stepper . animationDuration ) . withContext ( 'Set 0/null animation duration and verify default value' )
566+ expect ( stepper . animationDuration )
561567 . toBe ( ( stepper as any ) . _defaultAnimationDuration ) ;
562568 testAnimationBehvior ( val , fix , false ) ;
563569 }
@@ -926,9 +932,7 @@ describe('Stepper service unit tests', () => {
926932 mockElementRef = { nativeElement : mockElement } ;
927933
928934 mockAnimationBuilder = {
929- // eslint-disable-next-line @typescript-eslint/no-unused-vars
930935 build : ( _a : AnimationMetadata | AnimationMetadata [ ] ) => ( {
931- // eslint-disable-next-line @typescript-eslint/no-unused-vars
932936 create : ( _e : any , _opt ?: AnimationOptions ) => ( {
933937 onDone : ( _fn : any ) => { } ,
934938 onStart : ( _fn : any ) => { } ,
@@ -950,7 +954,6 @@ describe('Stepper service unit tests', () => {
950954 } )
951955 } ;
952956
953- // eslint-disable-next-line @typescript-eslint/no-unused-vars
954957 mockPlatform = { isIOS : false } ;
955958
956959 mockDocument = {
@@ -962,14 +965,12 @@ describe('Stepper service unit tests', () => {
962965 removeEventListener : ( _type : string , _listener : ( this : HTMLElement , ev : MouseEvent ) => any ) => { }
963966 } ;
964967
965- // eslint-disable-next-line @typescript-eslint/no-unused-vars
966968 mockDir = {
967969 value : ( ) : Direction => 'rtl' ,
968970 document : ( ) => mockDocument ,
969971 rtl : ( ) => true
970972 } ;
971973
972- // eslint-disable-next-line @typescript-eslint/no-unused-vars
973974 mockCdr = {
974975 markForCheck : ( ) : void => { } ,
975976 detach : ( ) : void => { } ,
@@ -989,16 +990,8 @@ describe('Stepper service unit tests', () => {
989990 }
990991 } ) ;
991992
992- it ( 'should properly register the specified stepper' , ( ) => {
993- stepperService = new IgxStepperService ( ) ;
994- expect ( ( stepperService as any ) . stepper ) . toBeFalsy ( ) ;
995- stepperService . register ( stepper ) ;
996- expect ( ( stepperService as any ) . stepper ) . toEqual ( stepper ) ;
997- } ) ;
998-
999993 it ( 'should expand a step by activating it and firing the step\'s activeChange event' , ( ) => {
1000994 spyOnProperty ( stepper , 'orientation' , 'get' ) . and . returnValue ( IgxStepperOrientation . Horizontal ) ;
1001- expect ( stepper . orientation ) . toBe ( IgxStepperOrientation . Horizontal ) ;
1002995 spyOnProperty ( stepper , 'steps' , 'get' ) . and . returnValue ( steps ) ;
1003996
1004997 stepperService . activeStep = steps [ 0 ] ;
@@ -1015,12 +1008,10 @@ describe('Stepper service unit tests', () => {
10151008 expect ( steps [ 1 ] . activeChange . emit ) . toHaveBeenCalledWith ( true ) ;
10161009
10171010 spyOnProperty ( stepper , 'orientation' , 'get' ) . and . returnValue ( IgxStepperOrientation . Vertical ) ;
1018- expect ( stepper . orientation ) . toBe ( IgxStepperOrientation . Vertical ) ;
10191011 stepperService . expand ( steps [ 0 ] ) ;
10201012
10211013 expect ( stepperService . activeStep ) . toBe ( steps [ 0 ] ) ;
1022- expect ( steps [ 0 ] . activeChange . emit ) . toHaveBeenCalledTimes ( 1 ) ;
1023- expect ( steps [ 0 ] . activeChange . emit ) . toHaveBeenCalledWith ( true ) ;
1014+ expect ( steps [ 0 ] . activeChange . emit ) . toHaveBeenCalledOnceWith ( true ) ;
10241015
10251016 const testValues = [ null , undefined , [ ] , { } , 'sampleString' ] ;
10261017
@@ -1033,7 +1024,6 @@ describe('Stepper service unit tests', () => {
10331024
10341025 it ( 'should expand a step through API by activating it and firing the step\'s activeChange event' , ( ) => {
10351026 spyOnProperty ( stepper , 'orientation' , 'get' ) . and . returnValue ( IgxStepperOrientation . Horizontal ) ;
1036- expect ( stepper . orientation ) . toBe ( IgxStepperOrientation . Horizontal ) ;
10371027 spyOnProperty ( stepper , 'steps' , 'get' ) . and . returnValue ( steps ) ;
10381028
10391029 stepperService . activeStep = steps [ 0 ] ;
@@ -1044,13 +1034,10 @@ describe('Stepper service unit tests', () => {
10441034 stepperService . expandThroughApi ( steps [ 1 ] ) ;
10451035
10461036 expect ( stepperService . activeStep ) . toBe ( steps [ 1 ] ) ;
1047- expect ( steps [ 0 ] . activeChange . emit ) . toHaveBeenCalledTimes ( 1 ) ;
1048- expect ( steps [ 0 ] . activeChange . emit ) . toHaveBeenCalledWith ( false ) ;
1049- expect ( steps [ 1 ] . activeChange . emit ) . toHaveBeenCalledTimes ( 1 ) ;
1050- expect ( steps [ 1 ] . activeChange . emit ) . toHaveBeenCalledWith ( true ) ;
1037+ expect ( steps [ 0 ] . activeChange . emit ) . toHaveBeenCalledOnceWith ( false ) ;
1038+ expect ( steps [ 1 ] . activeChange . emit ) . toHaveBeenCalledOnceWith ( true ) ;
10511039
10521040 spyOnProperty ( stepper , 'orientation' , 'get' ) . and . returnValue ( IgxStepperOrientation . Vertical ) ;
1053- expect ( stepper . orientation ) . toBe ( IgxStepperOrientation . Vertical ) ;
10541041 stepperService . expandThroughApi ( steps [ 0 ] ) ;
10551042
10561043 expect ( stepperService . activeStep ) . toBe ( steps [ 0 ] ) ;
@@ -1070,7 +1057,6 @@ describe('Stepper service unit tests', () => {
10701057
10711058 it ( 'should collapse the currently active step and fire the change event' , ( ) => {
10721059 spyOnProperty ( stepper , 'orientation' , 'get' ) . and . returnValue ( IgxStepperOrientation . Horizontal ) ;
1073- expect ( stepper . orientation ) . toBe ( IgxStepperOrientation . Horizontal ) ;
10741060 spyOnProperty ( stepper , 'steps' , 'get' ) . and . returnValue ( steps ) ;
10751061
10761062 stepperService . previousActiveStep = steps [ 0 ] ;
@@ -1088,12 +1074,10 @@ describe('Stepper service unit tests', () => {
10881074 expect ( stepperService . collapsingSteps ) . not . toContain ( steps [ 0 ] ) ;
10891075 expect ( stepperService . activeStep ) . not . toBe ( steps [ 0 ] ) ;
10901076 expect ( stepperService . activeStep ) . toBe ( steps [ 1 ] ) ;
1091- expect ( steps [ 0 ] . activeChange . emit ) . toHaveBeenCalledTimes ( 1 ) ;
1092- expect ( steps [ 0 ] . activeChange . emit ) . toHaveBeenCalledWith ( false ) ;
1077+ expect ( steps [ 0 ] . activeChange . emit ) . toHaveBeenCalledOnceWith ( false ) ;
10931078 expect ( steps [ 1 ] . activeChange . emit ) . not . toHaveBeenCalled ( ) ;
10941079
10951080 spyOnProperty ( stepper , 'orientation' , 'get' ) . and . returnValue ( IgxStepperOrientation . Vertical ) ;
1096- expect ( stepper . orientation ) . toBe ( IgxStepperOrientation . Vertical ) ;
10971081
10981082 stepperService . previousActiveStep = steps [ 1 ] ;
10991083 stepperService . activeStep = steps [ 0 ] ;
@@ -1108,8 +1092,7 @@ describe('Stepper service unit tests', () => {
11081092 expect ( stepperService . activeStep ) . not . toBe ( steps [ 1 ] ) ;
11091093 expect ( stepperService . activeStep ) . toBe ( steps [ 0 ] ) ;
11101094
1111- expect ( steps [ 1 ] . activeChange . emit ) . toHaveBeenCalledTimes ( 1 ) ;
1112- expect ( steps [ 1 ] . activeChange . emit ) . toHaveBeenCalledWith ( false ) ;
1095+ expect ( steps [ 1 ] . activeChange . emit ) . toHaveBeenCalledOnceWith ( false ) ;
11131096 expect ( steps [ 0 ] . activeChange . emit ) . not . toHaveBeenCalledTimes ( 2 ) ;
11141097
11151098 const testValues = [ null , undefined , [ ] , { } , 'sampleString' ] ;
@@ -1146,7 +1129,6 @@ describe('Stepper service unit tests', () => {
11461129
11471130 it ( 'should determine the steps that should be disabled in linear mode based on the validity of the active step' , ( ) => {
11481131 spyOnProperty ( stepper , 'orientation' , 'get' ) . and . returnValue ( IgxStepperOrientation . Horizontal ) ;
1149- expect ( stepper . orientation ) . toBe ( IgxStepperOrientation . Horizontal ) ;
11501132 spyOnProperty ( stepper , 'steps' ) . and . returnValue ( steps ) ;
11511133
11521134 for ( const step of steps ) {
@@ -1192,7 +1174,6 @@ describe('Stepper service unit tests', () => {
11921174
11931175 it ( 'should emit activating event' , ( ) => {
11941176 spyOnProperty ( stepper , 'orientation' , 'get' ) . and . returnValue ( IgxStepperOrientation . Horizontal ) ;
1195- expect ( stepper . orientation ) . toBe ( IgxStepperOrientation . Horizontal ) ;
11961177 spyOnProperty ( stepper , 'steps' ) . and . returnValue ( steps ) ;
11971178 const activeChangingSpy = spyOn ( stepper . activeStepChanging , 'emit' ) ;
11981179 stepperService . activeStep = steps [ 0 ] ;
0 commit comments