nuka-carousel
Advanced tools
Comparing version 3.1.0 to 3.2.0
@@ -95,2 +95,3 @@ 'use strict'; | ||
initialSlideWidth: _propTypes2.default.number, | ||
onResize: _propTypes2.default.func, | ||
shouldRecalculateHeight: _propTypes2.default.bool, | ||
@@ -124,2 +125,3 @@ slideIndex: _propTypes2.default.number, | ||
heightMode: 'first', | ||
onResize: function onResize() {}, | ||
shouldRecalculateHeight: false, | ||
@@ -633,3 +635,3 @@ slideIndex: 0, | ||
onResize: function onResize() { | ||
this.setDimensions(); | ||
this.setDimensions(null, this.props.onResize); | ||
}, | ||
@@ -692,2 +694,4 @@ onReadyStateChange: function onReadyStateChange() { | ||
setDimensions: function setDimensions(props) { | ||
var stateCb = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : function () {}; | ||
props = props || this.props; | ||
@@ -752,2 +756,3 @@ | ||
}, function () { | ||
stateCb(); | ||
self.setLeft(); | ||
@@ -754,0 +759,0 @@ }); |
{ | ||
"name": "nuka-carousel", | ||
"version": "3.1.0", | ||
"version": "3.2.0", | ||
"description": "Pure React Carousel", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -76,2 +76,3 @@ 'use strict'; | ||
initialSlideWidth: PropTypes.number, | ||
onResize: PropTypes.func, | ||
shouldRecalculateHeight: PropTypes.bool, | ||
@@ -108,2 +109,3 @@ slideIndex: PropTypes.number, | ||
heightMode: 'first', | ||
onResize: function() { }, | ||
shouldRecalculateHeight: false, | ||
@@ -731,3 +733,3 @@ slideIndex: 0, | ||
onResize() { | ||
this.setDimensions(); | ||
this.setDimensions(null, this.props.onResize); | ||
}, | ||
@@ -805,3 +807,3 @@ | ||
setDimensions(props) { | ||
setDimensions(props, stateCb = () => {}) { | ||
props = props || this.props; | ||
@@ -873,2 +875,3 @@ | ||
function() { | ||
stateCb(); | ||
self.setLeft(); | ||
@@ -875,0 +878,0 @@ } |
@@ -521,2 +521,20 @@ 'use strict'; | ||
describe('setDimensions', () => { | ||
it('should call the method\'s callback after setState', () => { | ||
var onResizeSpy = sinon.stub(); | ||
component = ReactDOM.render( | ||
React.createElement(carousel, { onResize: onResizeSpy }, | ||
React.createElement('p', null, 'Slide 1'), | ||
React.createElement('p', null, 'Slide 2'), | ||
React.createElement('p', null, 'Slide 3') | ||
), | ||
container | ||
); | ||
component.onResize(); | ||
expect(onResizeSpy).to.have.been.called; | ||
}); | ||
}); | ||
it('should advance if nextSlide() is called', function() { | ||
@@ -523,0 +541,0 @@ component = ReactDOM.render( |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
111605
3100
0