fix: type signature of Component too narrow

This commit is contained in:
M. George Hansen 2020-06-03 17:27:12 -07:00
parent 8dd0fb94e9
commit cbd80f381c
4 changed files with 23 additions and 7 deletions

View file

@ -86,4 +86,21 @@ testSuite("renderPage", ({ test, expect }) => {
"<!DOCTYPE html><html>There are <div>1</div><div>2</div><div>3</div> lights!</html>"
);
});
test("renders components w/ custom properties", () => {
interface LightProps {
nLights: number;
}
const Light: Component<LightProps> = ({ nLights }) => (
<div>{nLights} lights</div>
);
const html = renderPage(
<html>
There are <Light nLights={3} />!
</html>
);
expect(html).toEqual(
"<!DOCTYPE html><html>There are <div>3 lights</div>!</html>"
);
});
});