Skip to content

Commit

Permalink
fix(): show carousel's dots also when legacyIe11Mode is enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
Ks89 committed Dec 6, 2018
1 parent 26bc77e commit 7eea068
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -306,33 +306,32 @@ function checkCurrentImageIe11Legacy(currentImage: Image, val: TestModel, withDo
expect(currentImageElement.properties['title']).toBe(val.currentImgTitle);
expect(currentImageElement.properties['tabIndex']).toBe(0);

// FIXME temporary not supported on IE11
// if (withDots) {
// const dotsMainContainer: DebugElement = element.query(By.css('div#dots'));
// expect(dotsMainContainer.name).toBe('div');
// const dotsContainer: DebugElement = element.query(By.css('nav.dots-container'));
// expect(dotsContainer.name).toBe('nav');
// expect(dotsContainer.attributes['aria-label']).toBe(accessibilityConfig.dotsContainerAriaLabel);
// expect(dotsContainer.properties['title']).toBe(accessibilityConfig.dotsContainerTitle);
// const dots: DebugElement[] = dotsContainer.children;
// expect(dots.length).toBe(IMAGES.length);
//
// const activeDotIndex = 0;
// dots.forEach((dot: DebugElement, index: number) => {
// expect(dot.name).toBe('div');
// expect(dot.attributes['role']).toBe('navigation');
// expect(dot.properties['tabIndex']).toBe(0);
// if (index === activeDotIndex) {
// // I don't know why, but with dot.attributes['class'] I can't see 'active'. In this way it's working!
// // TODO fix this because is not working as expected. This line is ok, but tests aren't restarting from image 0
// // expect(dot.classes).toEqual({'inside': true, 'dot': true, 'active': true});
// } else {
// expect(dot.attributes['class']).toBe('inside dot');
// // or like above: expect(dot.classes).toEqual({'inside': true, 'dot': true});
// }
// expect(dot.attributes['aria-label']).toBe(accessibilityConfig.dotAriaLabel + ' ' + (index + 1));
// });
// }
if (withDots) {
const dotsMainContainer: DebugElement = element.query(By.css('div#dots-ie11'));
expect(dotsMainContainer.name).toBe('div');
const dotsContainer: DebugElement = element.query(By.css('nav.dots-container'));
expect(dotsContainer.name).toBe('nav');
expect(dotsContainer.attributes['aria-label']).toBe(accessibilityConfig.dotsContainerAriaLabel);
expect(dotsContainer.properties['title']).toBe(accessibilityConfig.dotsContainerTitle);
const dots: DebugElement[] = dotsContainer.children;
expect(dots.length).toBe(IMAGES.length);

const activeDotIndex = 0;
dots.forEach((dot: DebugElement, index: number) => {
expect(dot.name).toBe('div');
expect(dot.attributes['role']).toBe('navigation');
expect(dot.properties['tabIndex']).toBe(0);
if (index === activeDotIndex) {
// I don't know why, but with dot.attributes['class'] I can't see 'active'. In this way it's working!
// TODO fix this because is not working as expected. This line is ok, but tests aren't restarting from image 0
// expect(dot.classes).toEqual({'inside': true, 'dot': true, 'active': true});
} else {
expect(dot.attributes['class']).toBe('inside dot');
// or like above: expect(dot.classes).toEqual({'inside': true, 'dot': true});
}
expect(dot.attributes['aria-label']).toBe(accessibilityConfig.dotAriaLabel + ' ' + (index + 1));
});
}
}

function checkDescription(currentImage: Image, carouselImageConfig: CarouselImageConfig) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,14 @@
[title]="accessibilityConfig.carouselNextImageTitle"></div>
</a>

<div id="dots-ie11">
<ks-dots [currentImage]="currentImage"
[dotsConfig]="configDots"
[accessibilityConfig]="accessibilityConfig"
[images]="images"
(clickDot)="onClickDot($event)"></ks-dots>
</div>

</div>
</ng-template>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,5 +122,11 @@ $figcaption-right: 0;
bottom: $dots-bottom-position;
width: 100%;
}

> #dots-ie11 {
position: absolute;
bottom: $dots-bottom-position;
width: 100%;
}
}
}

0 comments on commit 7eea068

Please sign in to comment.