swiper icon indicating copy to clipboard operation
swiper copied to clipboard

Swiper/React - Active class not set within unit-test

Open MarcoLeko opened this issue 3 years ago • 3 comments

Check that this is really a bug

  • [X] I confirm

Reproduction link

https://codesandbox.io/s/jest-testing-react-forked-qxoe7b

Bug description

It seems while in the browser the swiper-slide-active class is set and switches everytime a swipe happened, this bevahiour is not reproducable within a unit test.

My intention is to test if a function was triggered on a slide-change, but since the swiper-slide-active class is not even set in the jsDOM environment, it seems that the swiper is not even properly initiated.

Expected Behavior

The expected behaviour is, that the active class swiper-slide-active is also set when rendering the swiper within a unit test, using jest/react.

Actual Behavior

The swiper-slide-active is never set, which is an indicator, that the swiper container is never properly initiated.

See provided sandbox environment.

Swiper version

8.1.4

Platform/Target and Browser Versions

jsDOM environment

Validations

  • [X] Follow our Code of Conduct
  • [X] Read the docs.
  • [X] Check that there isn't already an issue that request the same feature to avoid creating a duplicate.
  • [X] Make sure this is a Swiper issue and not a framework-specific issue

Would you like to open a PR for this bug?

  • [X] I'm willing to open a PR

MarcoLeko avatar May 15 '22 08:05 MarcoLeko

We encountered the same issue in Angular. Are there any workarounds?

denniseffing avatar Jun 20 '22 14:06 denniseffing

Unfurtunately the only workaround for this is skip the test 🤦🏻‍♂️

Sorry to say this. Is unfurtunate, that noone is reacting to this

MarcoLeko avatar Aug 12 '22 11:08 MarcoLeko

Having the same issue.

juan-villasenor avatar Sep 06 '22 20:09 juan-villasenor

Also facing the same issue.

leilahbirchall avatar Nov 03 '22 12:11 leilahbirchall

I am too.

Wuffle1125 avatar Nov 12 '22 22:11 Wuffle1125

I am too 🫤

oscarcornejo avatar Apr 05 '23 03:04 oscarcornejo

Issue is closed because of outdated/irrelevant/not actual/needed more information/inactivity.

If this issue is still actual and reproducible for latest version of Swiper, please create new issue and fill the issue template correctly:

  • Clearly describe the issue including steps to reproduce when it is a bug.
  • Make sure you fill in the earliest version that you know has the issue.
  • Provide live link or JSFiddle/Codepen or website with issue

nolimits4web avatar Oct 24 '23 12:10 nolimits4web