Skip to content

Commit 25f6786

Browse files
Add unit tests
1 parent b027be0 commit 25f6786

File tree

1 file changed

+22
-1
lines changed

1 file changed

+22
-1
lines changed

test/unit/carousel.tests.js

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import sinon from 'sinon';
66
import sinonChai from 'sinon-chai';
77
import Carousel from '../../src/index';
88

9-
109
chai.use(sinonChai);
1110
let imagesFetched;
1211

@@ -447,6 +446,28 @@ describe('Carousel', () => {
447446
expect(selectedSlide.prop('style').opacity).to.equal(1);
448447
});
449448

449+
it('should render vertical carousal with default arrows.', () => {
450+
renderToJsdom(
451+
<Carousel slideWidth='300px'
452+
viewportWidth='300px'
453+
lazyLoad={ false }
454+
infinite={ false }
455+
isVertical={ true }>
456+
<div id='slide1' />
457+
<div id='slide2' />
458+
<div id='slide3' />
459+
</Carousel>);
460+
const topArrow = tree.find('.carousel-top-arrow');
461+
const bottomArrow = tree.find('.carousel-bottom-arrow');
462+
const carousalDiv = tree.find('.carousel-container-inner');
463+
464+
expect(carousalDiv.prop('style').display).to.eql('flex');
465+
expect(topArrow.length).to.eql(1);
466+
expect(topArrow.children().html()).to.eql('<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24"><path d="m0 16.67 2.829 2.83 9.175-9.339 9.167 9.339L24 16.67 12.004 4.5z"></path></svg>');
467+
expect(bottomArrow.length).to.eql(1);
468+
expect(bottomArrow.children().html()).to.eql('<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24"><path d="M0 7.33 2.829 4.5l9.175 9.339L21.171 4.5 24 7.33 12.004 19.5z"></path></svg>');
469+
});
470+
450471
it('should have transitions with the given duration and easing', done => {
451472
let slidingCarousel;
452473

0 commit comments

Comments
 (0)