forked from akiran/react-slick
-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
completed the simpleslider test and started centerMode test
- Loading branch information
1 parent
34b4ca0
commit 0711da9
Showing
5 changed files
with
163 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
import React from "react"; | ||
import CenterMode from "../CenterMode"; | ||
import { render, fireEvent, waitFor, screen } from "@testing-library/react"; | ||
import { html as beautify_html } from "js-beautify"; | ||
import { | ||
activeSlides, | ||
getActiveSlidesCount, | ||
getClonesCount, | ||
getCurrentSlide, | ||
getSlidesCount | ||
} from "../../test-utils"; | ||
|
||
describe("CenterMode Tests", () => { | ||
test("Counting test", () => { | ||
const { container } = render(<CenterMode />); | ||
let totalSlides = getSlidesCount(container); | ||
let clonedSlides = getClonesCount(container); | ||
let activeSlides = getActiveSlidesCount(container); | ||
expect(totalSlides).toEqual(16); | ||
expect(clonedSlides).toEqual(10); | ||
expect(activeSlides).toEqual(3); | ||
expect(beautify_html(toString(container))).toMatchSnapshot(); | ||
}); | ||
test("Positioning test", () => { | ||
const { container } = render(<CenterMode />); | ||
let currentSlide = getCurrentSlide(container); | ||
console.log(currentSlide[0]); | ||
// Array.from(currentSlide).map(e=>console.log(e)) | ||
//let activeSlides = activeSlides(container); | ||
expect(currentSlide.props()["data-index"]).toEqual(0); | ||
// expect(activeSlides.map(slide => slide.props()["data-index"])).toEqual([ | ||
// -1, | ||
// 0, | ||
// 1 | ||
// ]); | ||
// expect(beautify_html(slider.html())).toMatchSnapshot(); | ||
}); | ||
// test("Activity test", () => { | ||
// const slider = mount(<CenterMode />); | ||
// let currentSlide = slider.find("div.slick-current"); | ||
// let activeSlides = slider.find("div.slick-active"); | ||
// expect(currentSlide.props()["data-index"]).toEqual(0); | ||
// expect(activeSlides.map(slide => slide.props()["data-index"])).toEqual([ | ||
// -1, | ||
// 0, | ||
// 1 | ||
// ]); | ||
|
||
// clickNext(slider); | ||
|
||
// currentSlide = slider.find("div.slick-current"); | ||
// activeSlides = slider.find("div.slick-active"); | ||
// expect(currentSlide.props()["data-index"]).toEqual(1); | ||
// expect(activeSlides.map(slide => slide.props()["data-index"])).toEqual([ | ||
// 0, | ||
// 1, | ||
// 2 | ||
// ]); | ||
|
||
// expect(beautify_html(slider.html())).toMatchSnapshot(); | ||
// }); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`CenterMode Tests Counting test 1`] = `"[object Undefined]"`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`Simple Slider Snapshots click on 3rd dot 1`] = `"[object Undefined]"`; | ||
|
||
exports[`Simple Slider Snapshots click on next button 1`] = `"[object Undefined]"`; | ||
|
||
exports[`Simple Slider Snapshots click on prev button 1`] = `"[object Undefined]"`; | ||
|
||
exports[`Simple Slider Snapshots slider initial state 1`] = `"[object Undefined]"`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters