Download react-slick/__tests__/regression/fix-2414.test.js from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 1.94 kB
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/react-slick/__tests__/regression/fix-2414.test.js
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset/react-slick/__tests__/regression/fix-2414.test.js
-
curl -L -o fix-2414.test.js https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/react-slick/__tests__/regression/fix-2414.test.js
1.94 kB
| // Test fix of #2414: Extra clones in infinite mode when there is only one slide or unslick is true | |
| import React from "react"; | |
| import { render, fireEvent } from "@testing-library/react"; | |
| import { | |
| getCurrentSlideContent, | |
| getSlidesCount, | |
| getActiveSlidesCount, | |
| getClonesCount, | |
| hasArrows, | |
| hasDots | |
| } from "../../test-utils"; | |
| import { GenericSliderComponent } from "../TestComponents"; | |
| function SliderWithOneSlide() { | |
| const settings = { | |
| dots: true, | |
| infinite: true | |
| }; | |
| return <GenericSliderComponent slidesCount={1} settings={settings} />; | |
| } | |
| function SliderWithUnslick() { | |
| const settings = { | |
| dots: true, | |
| infinite: true, | |
| unslick: true | |
| }; | |
| return <GenericSliderComponent slidesCount={2} settings={settings} />; | |
| } | |
| describe("Slider with one slide", function() { | |
| it("should have 1 active slide", function() { | |
| const { container } = render(<SliderWithOneSlide />); | |
| expect(getActiveSlidesCount(container)).toEqual(1); | |
| }); | |
| it("should not have any clones", function() { | |
| const { container } = render(<SliderWithOneSlide />); | |
| expect(getClonesCount(container)).toEqual(0); | |
| }); | |
| it("should no have dots and arrows", function() { | |
| const { container } = render(<SliderWithOneSlide />); | |
| expect(hasArrows(container)).toEqual(false); | |
| expect(hasDots(container)).toEqual(false); | |
| }); | |
| }); | |
| describe("Slider with unslick=true", function() { | |
| it("should have one active slide", function() { | |
| const { container } = render(<SliderWithUnslick />); | |
| expect(getActiveSlidesCount(container)).toEqual(1); | |
| }); | |
| it("should not have any clones", function() { | |
| const { container } = render(<SliderWithUnslick />); | |
| expect(getClonesCount(container)).toEqual(0); | |
| }); | |
| it("should no have dots and arrows", function() { | |
| const { container } = render(<SliderWithUnslick />); | |
| expect(hasArrows(container)).toEqual(false); | |
| expect(hasDots(container)).toEqual(false); | |
| }); | |
| }); | |