Download react-slick/examples/__tests__/FocusOnSelect.test.js from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 1.03 kB
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/1e92f2d0b9e054abc23a53595fd89ad3e2b4a34e/react-slick/examples/__tests__/FocusOnSelect.test.js
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset@1e92f2d0b9e054abc23a53595fd89ad3e2b4a34e/react-slick/examples/__tests__/FocusOnSelect.test.js
-
curl -L -o FocusOnSelect.test.js https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/1e92f2d0b9e054abc23a53595fd89ad3e2b4a34e/react-slick/examples/__tests__/FocusOnSelect.test.js
1.03 kB
| import React from "react"; | |
| import { render, fireEvent } from "@testing-library/react"; | |
| import { html as beautify_html } from "js-beautify"; | |
| import { | |
| activeSlide, | |
| clickNext, | |
| clickPrevious, | |
| getButtons, | |
| getCurrentSlide | |
| } from "../../test-utils"; | |
| import FocusOnSelect from "../FocusOnSelect"; | |
| describe("FocusOnSelect Tests", () => { | |
| test("Activity Test", () => { | |
| const { container } = render(<FocusOnSelect />); | |
| expect( | |
| parseInt(getCurrentSlide(container).getAttribute("data-index")) | |
| ).toEqual(0); | |
| // expect(beautify_html(toString(container))).toMatchSnapshot(); | |
| Array.from(container.getElementsByClassName("slick-slide")).map(e => | |
| e.getAttribute("data-index") == "2" | |
| ? fireEvent( | |
| e, | |
| new MouseEvent("click", { bubbles: true, cancelable: true }) | |
| ) | |
| : null | |
| ); | |
| expect( | |
| parseInt(getCurrentSlide(container).getAttribute("data-index")) | |
| ).toEqual(2); | |
| //expect(beautify_html(toString(container))).toMatchSnapshot(); | |
| }); | |
| }); | |