Download ant-design/components/_util/__tests__/reactNode.test.tsx from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 607 Bytes
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/f5071caa249115f3b590492f1c8eb471e02aae4b/ant-design/components/_util/__tests__/reactNode.test.tsx
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset@f5071caa249115f3b590492f1c8eb471e02aae4b/ant-design/components/_util/__tests__/reactNode.test.tsx
-
curl -L -o reactNode.test.tsx https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/f5071caa249115f3b590492f1c8eb471e02aae4b/ant-design/components/_util/__tests__/reactNode.test.tsx
607 Bytes
| import React from 'react'; | |
| import { cloneElement, isFragment, replaceElement } from '../reactNode'; | |
| describe('reactNode test', () => { | |
| it('isFragment', () => { | |
| expect(isFragment(<p>test</p>)).toBe(false); | |
| expect(isFragment(<>test</>)).toBe(true); | |
| }); | |
| it('replaceElement', () => { | |
| const node = <p>test</p>; | |
| expect(replaceElement(null, node)).toBe(node); | |
| expect(replaceElement(node, node)).toStrictEqual(node); | |
| }); | |
| it('cloneElement', () => { | |
| const node = <p>test</p>; | |
| expect(cloneElement(null)).toBe(null); | |
| expect(cloneElement(node)).toStrictEqual(node); | |
| }); | |
| }); | |