Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
tnicola committed Mar 6, 2019
2 parents 3bc37c8 + 55c93bd commit a46c78b
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/lib/src/components/step/joyride-step.component.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<div #stepHolder class="joyride-step__holder" [style.top.px]="topPosition" [style.left.px]="leftPosition">
<div #stepHolder class="joyride-step__holder" [id]="'joyride-step-' + step.name" [style.top.px]="topPosition" [style.left.px]="leftPosition">
<joyride-arrow *ngIf="showArrow" class="joyride-step__arrow" [position]="arrowPosition" [style.top.px]="arrowTopPosition"
[style.left.px]="arrowLeftPosition"></joyride-arrow>
<div #stepContainer class="joyride-step__container">
Expand Down
11 changes: 11 additions & 0 deletions src/lib/src/components/step/joyride-step.component.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,17 @@ describe('JoyrideStepComponent', () => {
expect(stepHolder.nativeElement.style.transform).toBe('translateX(-50px)');
});

it('should have id with step name on step holder div', () => {
STEP.name = "myStep";
component.step = STEP;
component.ngAfterViewInit();

hostFixture.detectChanges();

let stepHolder = hostFixture.debugElement.query(By.css('.joyride-step__holder'));
expect(stepHolder.nativeElement.id).toBe('joyride-step-myStep');
});

describe('when the step position is "top"', () => {
beforeEach(() => {
STEP.position = 'top';
Expand Down
8 changes: 8 additions & 0 deletions src/lib/src/services/joyride-backdrop.service.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,14 @@ describe('JoyrideBackdropService', () => {
expect(styles.height).toBe('34px');
expect(styles.getPropertyValue('flex-shrink')).toBe('0');
});

it('should set id to contain step name', () => {
STEP.name = 'myStep';
backdropService.draw(STEP);

let backdropMiddleContainer = document.getElementsByClassName('backdrop-container')[0];
expect(backdropMiddleContainer.id).toBe('backdrop-myStep');
});
});

describe('redraw() and redrawTarget()', () => {
Expand Down
1 change: 1 addition & 0 deletions src/lib/src/services/joyride-backdrop.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ export class JoyrideBackdropService {
this.renderer.setStyle(this.currentBackdropContainer, 'width', '100%');
this.renderer.setStyle(this.currentBackdropContainer, 'height', '100%');
this.renderer.setStyle(this.currentBackdropContainer, 'z-index', '1000');
this.renderer.setAttribute(this.currentBackdropContainer, 'id', 'backdrop-' + step.name);

this.backdropContent = this.renderer.createElement('div');
this.renderer.addClass(this.backdropContent, 'backdrop-content');
Expand Down

0 comments on commit a46c78b

Please sign in to comment.