Add testcase - getRootFiberNodeFromDOM - without any element as input

This commit is contained in:
2019-08-10 17:20:20 +05:30
parent e3750e9b50
commit 3e062ef911
@@ -53,6 +53,20 @@ describe("traverse", () => {
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", () => {
const C1 = createClassComponent("C1");
const containerInner = container.appendChild(