New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

react-img-carousel

Package Overview
Dependencies
Maintainers
17
Versions
40
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-img-carousel - npm Package Compare versions

Comparing version 2.1.0 to 2.1.1

4

CHANGELOG.md

@@ -0,1 +1,5 @@

# 2.1.1 - Aug 2021
***(Bug Fix)*** Fixes the index passed to beforeChange callback when infinite scrolling is enabled.
# 2.1.0 - May 2021

@@ -2,0 +6,0 @@

2

lib/index.js

@@ -188,3 +188,3 @@ "use strict";

this._animating = true;
beforeChange && beforeChange(index, currentSlide, direction);
beforeChange && beforeChange(newIndex, currentSlide, direction);
this.setState({

@@ -191,0 +191,0 @@ transitionDuration

{
"name": "react-img-carousel",
"version": "2.1.0",
"version": "2.1.1",
"description": "Provides an image carousel React component.",

@@ -5,0 +5,0 @@ "main": "lib/index.js",

@@ -333,3 +333,3 @@ /* eslint

beforeChange && beforeChange(index, currentSlide, direction);
beforeChange && beforeChange(newIndex, currentSlide, direction);
this.setState({

@@ -336,0 +336,0 @@ transitionDuration

@@ -112,2 +112,3 @@ /* eslint max-statements: 0, jsx-a11y/alt-text: 0 */

const onSlideTransitionedStub = sinon.stub();
const beforeChangeStub = sinon.stub();

@@ -119,3 +120,4 @@ renderToJsdom(

infinite={ true }
onSlideTransitioned={ onSlideTransitionedStub }>
onSlideTransitioned={ onSlideTransitionedStub }
beforeChange={ beforeChangeStub }>
<div id='slide1'/>

@@ -141,2 +143,3 @@ <div id='slide2'/>

});
expect(beforeChangeStub).to.have.been.calledWith(0, 2, 'right');
done();

@@ -147,4 +150,6 @@ });

it('should wrap around from the first to last slide if infinite is true and prev is clicked', done => {
const beforeChangeStub = sinon.stub();
renderToJsdom(
<Carousel initialSlide={ 2 } slideWidth='300px' viewportWidth='300px' infinite={ true }>
<Carousel initialSlide={ 0 } slideWidth='300px' viewportWidth='300px' infinite={ true } beforeChange={ beforeChangeStub }>
<div id='slide1'/>

@@ -159,8 +164,9 @@ <div id='slide2'/>

expect(dots.length).to.equal(3);
expect(dots.at(0).prop('className')).to.contain('selected');
const prevButton = tree.find('.carousel-left-arrow');
prevButton.simulate('click');
dots = tree.find('.carousel-dot');
expect(dots.at(0).prop('className')).to.not.contain('selected');
expect(dots.at(2).prop('className')).to.contain('selected');
const nextButton = tree.find('.carousel-right-arrow');
nextButton.simulate('click');
dots = tree.find('.carousel-dot');
expect(dots.at(2).prop('className')).to.not.contain('selected');
expect(dots.at(0).prop('className')).to.contain('selected');
expect(beforeChangeStub).to.have.been.calledWith(2, 0, 'left');
done();

@@ -167,0 +173,0 @@ });

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc