feat: provide Fragment component
Adds a new Fragment component that provides the same functionality as React.Fragment. See issue #9 for details. closes issue #9
This commit is contained in:
parent
72e015b4c2
commit
f773d79b91
4 changed files with 43 additions and 4 deletions
|
|
@ -3,7 +3,7 @@
|
|||
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
import { Component, createElement } from "../../dist";
|
||||
import { Component, createElement, Fragment } from "../../dist";
|
||||
import { renderPage } from "../../dist/render";
|
||||
import { testSuite } from "../lib";
|
||||
|
||||
|
|
@ -103,4 +103,18 @@ testSuite("renderPage", ({ test, expect }) => {
|
|||
"<!DOCTYPE html><html>There are <div>3 lights</div>!</html>"
|
||||
);
|
||||
});
|
||||
|
||||
test("renders fragment children only", () => {
|
||||
const html = renderPage(
|
||||
<html>
|
||||
<Fragment>
|
||||
<div>test of</div>
|
||||
<div>fragments</div>
|
||||
</Fragment>
|
||||
</html>
|
||||
);
|
||||
expect(html).toEqual(
|
||||
"<!DOCTYPE html><html><div>test of</div><div>fragments</div></html>"
|
||||
);
|
||||
});
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue