diff --git a/test/CarouselSpec.jsx b/test/CarouselSpec.jsx index 6174dd16c0..f2a63568d9 100644 --- a/test/CarouselSpec.jsx +++ b/test/CarouselSpec.jsx @@ -73,4 +73,45 @@ describe('Carousel', function () { )[0] ); }); + + it('Should show all controls on the first/last image if wrap is true', function () { + var instance = ReactTestUtils.renderIntoDocument( + + Item 1 content + Item 2 content + + ); + + var backButton = ReactTestUtils.findRenderedDOMComponentWithClass(instance, 'left'); + + assert.ok(backButton); + assert.equal(backButton.props.href, '#prev'); + + instance = ReactTestUtils.renderIntoDocument( + + Item 1 content + Item 2 content + + ); + + var nextButton = ReactTestUtils.findRenderedDOMComponentWithClass(instance, 'right'); + + assert.ok(nextButton); + assert.equal(nextButton.props.href, '#next'); + }); + + it('Should not show the prev button on the first image if wrap is false', function () { + var instance = ReactTestUtils.renderIntoDocument( + + Item 1 content + Item 2 content + + ); + + var backButtons = ReactTestUtils.scryRenderedDOMComponentsWithClass(instance, 'left'); + var nextButtons = ReactTestUtils.scryRenderedDOMComponentsWithClass(instance, 'right'); + + assert.equal(backButtons.length, 0); + assert.equal(nextButtons.length, 1); + }); });