Skip to content

Commit

Permalink
fix(tests): added new checks to fix reference errors (#287)
Browse files Browse the repository at this point in the history
* fix(tests): added new checks to fix reference errors

* feat(test): fixed snapshot

* feat(test): fixed snapshot
  • Loading branch information
quinnlangille authored Oct 19, 2018
1 parent ca50172 commit fa2369e
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 9 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ logs
npm-debug.log*
yarn-debug.log*
yarn-error.log*
.idea/

# Runtime data
pids
Expand Down
4 changes: 2 additions & 2 deletions src/Carousel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -840,9 +840,9 @@ export default {
// when autoplay direction is backward start from the last slide
if (this.autoplayDirection === "backward") {
this.goToLastSlide();
this.goToLastSlide();
}
},
},
beforeDestroy() {
this.detachMutationObserver();
window.removeEventListener("resize", this.getBrowserWidth);
Expand Down
8 changes: 5 additions & 3 deletions src/Pagination.vue
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
width: ${carousel.paginationSize}px;
height: ${carousel.paginationSize}px;
background: ${isCurrentDot(index) ? carousel.paginationActiveColor : carousel.paginationColor};
`"
`"
></button>
</li>
</ul>
Expand All @@ -39,9 +39,11 @@ export default {
inject: ["carousel"],
computed: {
paginationCount() {
return this.carousel.scrollPerPage
return this.carousel && this.carousel.scrollPerPage
? this.carousel.pageCount
: this.carousel.slideCount - 2;
: this.carousel.slideCount
? this.carousel.slideCount - 2
: 0;
}
},
methods: {
Expand Down
2 changes: 1 addition & 1 deletion src/Slide.vue
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export default {
},
computed: {
activeSlides() {
const { currentPage, perPage, $children, slideCount } = this.carousel;
const { currentPage, perPage, $children } = this.carousel;
const activeSlides = [];
const children = $children
.filter(
Expand Down
4 changes: 2 additions & 2 deletions tests/client/components/__snapshots__/carousel.spec.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,11 @@ exports[`Carousel should decrease current slide number by 1 when advance slide b
".VueCarousel-wrapper
.VueCarousel-inner(role='listbox', style='transform: translate(0px, 0); visibility: hidden; height: auto;')
.VueCarousel-slide(tabindex='-1')
.VueCarousel-slide(tabindex='-1')
.VueCarousel-slide.VueCarousel-slide-active.VueCarousel-slide-center(tabindex='-1')
.VueCarousel-slide(tabindex='-1')
.VueCarousel-slide(tabindex='-1')
|
.VueCarousel-pagination
.VueCarousel-pagination(style='')
ul.VueCarousel-dot-container(role='tablist')
li.VueCarousel-dot(aria-hidden='false', role='presentation', aria-selected='false', style='margin-top: 20px; padding: 10px;')
button.VueCarousel-dot-button(type='button', role='button', aria-label='\`Item \${index}\`', title='Item 0', tabindex='0', style='width: 10px; height: 10px; background: rgb(239, 239, 239);')
Expand Down
2 changes: 1 addition & 1 deletion tests/client/components/__snapshots__/slide.spec.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
exports[`Slide should mount successfully 1`] = `
".VueCarousel-wrapper
.VueCarousel-inner(role='listbox', style='transform: translate(0px, 0); visibility: hidden; height: auto;')
.VueCarousel-slide.VueCarousel-slide-active(tabindex='-1')
.VueCarousel-slide(tabindex='-1')
|
.VueCarousel-pagination(style='display: none;')
ul.VueCarousel-dot-container(role='tablist')
Expand Down

0 comments on commit fa2369e

Please sign in to comment.