SSENSE / vue-carousel

A flexible, responsive, touch-friendly carousel for Vue.js
https://ssense.github.io/vue-carousel/
MIT License
1.72k stars 504 forks source link

Can not test carousel component #546

Open SchmidtDawid opened 4 years ago

SchmidtDawid commented 4 years ago

I have custom component look like this:

<template>
  <carousel
    class="custom-carousel"
    pagination-active-color="#BEE82F"
    pagination-color="#b3b3b3"
    :pagination-padding="5"
    :pagination-size="15"
    :loop="loop"
    :autoplay-timeout="autoplayTimeout"
    :autoplay="autoplay"
    :per-page="perPage"
    :autoplay-hover-pause="autoplayHoverPause"
    :navigation-enabled="navigationEnabled"
    :navigate-to="navigateTo"
    @pageChange="slideNumber"
  >
    <slot />
  </carousel>
</template>

How to test it? When i want to mount (not shallowMount) component i got error: [Vue warn]: Unknown custom element: <carousel> - did you register the component correctly? For recursive components, make sure to provide the "name" option.

I cant stub it because i need to test function in slides.

panfanky commented 3 years ago

I got rid of this error when using <carousel> and <slide> only in the html and only

<template>
  <div>
   <slot />
  </div>
</template>

in the .vue file But I am a noob to vue so I don't really understand the way components should be built :)