Download react-grid-layout/test/util/setupTests.js from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 633 Bytes
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/1e92f2d0b9e054abc23a53595fd89ad3e2b4a34e/react-grid-layout/test/util/setupTests.js
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset@1e92f2d0b9e054abc23a53595fd89ad3e2b4a34e/react-grid-layout/test/util/setupTests.js
-
curl -L -o setupTests.js https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/1e92f2d0b9e054abc23a53595fd89ad3e2b4a34e/react-grid-layout/test/util/setupTests.js
633 Bytes
| // @flow | |
| import Enzyme from "enzyme"; | |
| import Adapter from "enzyme-adapter-react-16"; | |
| Enzyme.configure({ adapter: new Adapter() }); | |
| // We rely on sort() being deterministic for tests, but it changed from QuickSort to TimSort | |
| // in Node 12. This breaks tests, so we monkey-patch it. | |
| import { sort } from "timsort"; | |
| // $FlowIgnore dirty hack | |
| Array.prototype.sort = function (comparator) { | |
| sort(this, comparator); | |
| return this; | |
| }; | |
| // Required in drag code, not working in JSDOM | |
| Object.defineProperty(HTMLElement.prototype, "offsetParent", { | |
| get() { | |
| // $FlowIgnore[object-this-reference] | |
| return this.parentNode; | |
| } | |
| }); | |