mirror of
https://github.com/bendtherules/react-fiber-traverse.git
synced 2026-08-18 22:01:49 +00:00
Add testcase - getRootFiberNodeFromDOM - without any element as input
This commit is contained in:
@@ -53,6 +53,20 @@ describe("traverse", () => {
|
|||||||
expect((resultPositive as any).child.child.type).toBe(C1);
|
expect((resultPositive as any).child.child.type).toBe(C1);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("should work without any element - default args", () => {
|
||||||
|
const C1 = createClassComponent("C1");
|
||||||
|
const containerInner = container.appendChild(
|
||||||
|
document.createElement("span")
|
||||||
|
);
|
||||||
|
mountAndGetRootNode(C1, containerInner);
|
||||||
|
|
||||||
|
const resultPositive = getRootFiberNodeFromDOM();
|
||||||
|
|
||||||
|
expect(resultPositive).not.toBeFalsy();
|
||||||
|
expect(resultPositive).not.toBe(null);
|
||||||
|
expect((resultPositive as any).child.child.type).toBe(C1);
|
||||||
|
});
|
||||||
|
|
||||||
it("should not work for child element", () => {
|
it("should not work for child element", () => {
|
||||||
const C1 = createClassComponent("C1");
|
const C1 = createClassComponent("C1");
|
||||||
const containerInner = container.appendChild(
|
const containerInner = container.appendChild(
|
||||||
|
|||||||
Reference in New Issue
Block a user