// Test lmount and useRenew functionality
import { h, Fragment, render, mount, lmount, useRenew } from '@/index';
// Test 1: Basic lmount without renew
const BasicLmount = lmount(() => {
return () =>
Basic lmount component
;
});
// Test 2: lmount with useRenew hook
const LmountWithRenew = lmount(() => {
let count = 0;
const renew = useRenew();
const increment = () => {
count++;
renew();
};
return () => (
{count}
);
});
// Test 3: Mixed mount and lmount
const MountParent = mount(renew => {
let parentCount = 0;
const incrementParent = () => {
parentCount++;
renew();
};
return () => (
{parentCount}
);
});
// Test 4: lmount child under mount parent
const LmountChild = lmount(() => {
let childCount = 0;
const renew = useRenew();
const incrementChild = () => {
childCount++;
renew();
};
return () => (
{childCount}
);
});
const MixedParent = mount(renew => {
let toggleState = true;
const toggle = () => {
toggleState = !toggleState;
renew();
};
return () => (
{toggleState ?
:
Off
}
);
});
// Root component
const Root = (
lmount Tests
);
//@ts-ignore
window.root = Root;
render(Root, document.getElementById('root'));