mirror of
https://github.com/bendtherules/react-fiber-traverse.git
synced 2026-08-18 13:52:36 +00:00
Remove some useless tests
This commit is contained in:
@@ -217,117 +217,5 @@ describe("traverseGenerator", () => {
|
||||
nodes.map(tmpNode => (tmpNode as FiberNodeForFunctionComponent).type)
|
||||
).toEqual([C1, C2, C3, C4, C5]);
|
||||
});
|
||||
|
||||
it("should work for depth=3 breadth-first", () => {
|
||||
class C1 extends React.Component {
|
||||
render() {
|
||||
return (
|
||||
<React.Fragment>
|
||||
<C2>
|
||||
<C5 />
|
||||
</C2>
|
||||
<C3>
|
||||
<C4 />
|
||||
</C3>
|
||||
</React.Fragment>
|
||||
);
|
||||
}
|
||||
}
|
||||
function C2(props: { children?: any }) {
|
||||
return props.children || null;
|
||||
}
|
||||
function C3(props: { children?: any }) {
|
||||
return props.children || null;
|
||||
}
|
||||
function C4(props: { children?: any }) {
|
||||
return props.children || null;
|
||||
}
|
||||
function C5(props: { children?: any }) {
|
||||
return props.children || null;
|
||||
}
|
||||
|
||||
const rootNode = mountAndGetRootNode(C1, container);
|
||||
|
||||
const nodeIterator = traverseGenerator(rootNode, {
|
||||
order: ["self", "sibling", "child"]
|
||||
});
|
||||
const nodes = [...nodeIterator];
|
||||
|
||||
expect(nodes.length).toBe(5);
|
||||
// Check depth-based order (default order)
|
||||
expect(
|
||||
nodes.map(tmpNode => (tmpNode as FiberNodeForFunctionComponent).type)
|
||||
).toEqual([C1, C2, C3, C4, C5]);
|
||||
});
|
||||
|
||||
// it("should work for depth=5 class", () => {
|
||||
// const rootNode = mountAndGetRootNode(CDepth5, container);
|
||||
|
||||
// const nodeIterator = traverseGenerator(rootNode);
|
||||
// const nodes = [...nodeIterator];
|
||||
|
||||
// expect(nodes.length).toBe(5);
|
||||
// });
|
||||
|
||||
// it("should work for depth=1 function", () => {
|
||||
// const WrappedC = getWrappedComponent(FnDepth1);
|
||||
// const rootNode = mountAndGetRootNode(WrappedC, container)
|
||||
// .child as FiberNodeForFunctionComponent;
|
||||
|
||||
// const nodeIterator = traverseGenerator(rootNode);
|
||||
// const nodes = [...nodeIterator];
|
||||
|
||||
// // Can't be zero, in any case
|
||||
// expect(nodes.length).not.toBe(0);
|
||||
// // Check that only one node is yielded
|
||||
// expect(nodes.length).toBe(1);
|
||||
// // Check type of node
|
||||
// expect((nodes[0] as FiberNodeForComponentClass).type).toBe(FnDepth1);
|
||||
// });
|
||||
|
||||
// it("should work for depth=3 function", () => {
|
||||
// function Fn1() {
|
||||
// return <Fn2 />;
|
||||
// }
|
||||
// function Fn2() {
|
||||
// return <div>Fn2 here</div>;
|
||||
// }
|
||||
|
||||
// const WrappedC = getWrappedComponent(Fn1);
|
||||
// const rootNode = mountAndGetRootNode(WrappedC, container)
|
||||
// .child as FiberNodeForFunctionComponent;
|
||||
|
||||
// const nodeIterator = traverseGenerator(rootNode);
|
||||
// const nodes = [...nodeIterator];
|
||||
|
||||
// // Check that only 3 nodes are yielded
|
||||
// expect(nodes.length).toBe(3);
|
||||
// // Check depth-based order (default order)
|
||||
// expect((nodes[0] as FiberNodeForFunctionComponent).type).toBe(Fn1);
|
||||
// expect((nodes[1] as FiberNodeForFunctionComponent).type).toBe(Fn2);
|
||||
// });
|
||||
|
||||
// it("should work for depth=5 function", () => {
|
||||
// function Fn1() {
|
||||
// return (
|
||||
// <header>
|
||||
// <Fn2 />
|
||||
// <button />
|
||||
// </header>
|
||||
// );
|
||||
// }
|
||||
// function Fn2() {
|
||||
// return <div>Fn2 here</div>;
|
||||
// }
|
||||
|
||||
// const WrappedC = getWrappedComponent(Fn1);
|
||||
// const rootNode = mountAndGetRootNode(WrappedC, container)
|
||||
// .child as FiberNodeForFunctionComponent;
|
||||
|
||||
// const nodeIterator = traverseGenerator(rootNode);
|
||||
// const nodes = [...nodeIterator];
|
||||
|
||||
// expect(nodes.length).toBe(5);
|
||||
// });
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user