Skip to content

Commit 9f53b23

Browse files
author
ddaribo
committed
refactor(stepper): keep up to PR changes
1 parent 0aab42a commit 9f53b23

File tree

1 file changed

+20
-20
lines changed

1 file changed

+20
-20
lines changed

projects/igniteui-angular/src/lib/stepper/stepper.component.spec.ts

+20-20
Original file line numberDiff line numberDiff line change
@@ -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

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+
445453
let 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,19 @@ describe('Rendering Tests', () => {
453461
});
454462

455463
stepper.orientation = IgxStepperOrientation.Vertical;
464+
stepper.titlePosition = null;
456465
fix.detectChanges();
457466

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+
458474
positions = getStepperPositions();
459475
positions.forEach((pos: IgxStepperTitlePosition) => {
460-
stepper.verticalTitlePosition = pos;
476+
stepper.titlePosition = pos;
461477
fix.detectChanges();
462478

463479
for (const step of stepper.steps) {
@@ -544,20 +560,11 @@ describe('Rendering Tests', () => {
544560
testAnimationBehvior(val, fix, false);
545561
}
546562

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];
563+
const fallbackToDefaultValues = [-1, 0, null, undefined, 'sampleString', [], {}];
557564
for (const val of fallbackToDefaultValues) {
558565
fix.componentInstance.animationDuration = val as any;
559566
fix.detectChanges();
560-
expect(stepper.animationDuration).withContext('Set 0/null animation duration and verify default value')
567+
expect(stepper.animationDuration)
561568
.toBe((stepper as any)._defaultAnimationDuration);
562569
testAnimationBehvior(val, fix, false);
563570
}
@@ -989,13 +996,6 @@ describe('Stepper service unit tests', () => {
989996
}
990997
});
991998

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-
999999
it('should expand a step by activating it and firing the step\'s activeChange event', () => {
10001000
spyOnProperty(stepper, 'orientation', 'get').and.returnValue(IgxStepperOrientation.Horizontal);
10011001
expect(stepper.orientation).toBe(IgxStepperOrientation.Horizontal);

0 commit comments

Comments
 (0)