Skip to content

Commit

Permalink
created a generic slider component for tests
Browse files Browse the repository at this point in the history
  • Loading branch information
akiran committed Jan 25, 2024
1 parent 891f399 commit 358d8c0
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 34 deletions.
13 changes: 13 additions & 0 deletions __tests__/TestComponents.js
@@ -0,0 +1,13 @@
import React from "react";
import Slider from "../src/index";

export function GenericSliderComponent({ slidesCount, settings }) {
const slides = [...Array(slidesCount).keys()].map(item => (
<div key={item}>{item + 1}</div>
));
return <Slider {...settings}>{slides}</Slider>;
}

test("fake test", () => {
expect(1).toBe(1);
});
Expand Up @@ -20,6 +20,7 @@ import {
getSlidesCount,
hasClass
} from "../../test-utils";
import { GenericSliderComponent } from "../TestComponents";

function MultipleItems() {
const settings = {
Expand All @@ -29,40 +30,7 @@ function MultipleItems() {
slidesToShow: 9,
slidesToScroll: 3
};
return (
<div>
<h2> Multiple items </h2>
<Slider {...settings}>
<div>
<h3>1</h3>
</div>
<div>
<h3>2</h3>
</div>
<div>
<h3>3</h3>
</div>
<div>
<h3>4</h3>
</div>
<div>
<h3>5</h3>
</div>
<div>
<h3>6</h3>
</div>
<div>
<h3>7</h3>
</div>
<div>
<h3>8</h3>
</div>
<div>
<h3>9</h3>
</div>
</Slider>
</div>
);
return <GenericSliderComponent slidesCount={9} settings={settings} />;
}

describe("Multiple Items with slidesToShow = slides count in infinite mode", function() {
Expand Down

0 comments on commit 358d8c0

Please sign in to comment.