-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #8 from qiushi1511/apps-docs-add-feat-istanbul
Apps docs add feat istanbul
- Loading branch information
Showing
3 changed files
with
71 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { expect, test } from "@jest/globals"; | ||
import { render, screen } from "@testing-library/react"; | ||
import Page from "./page"; | ||
|
||
test("Page", () => { | ||
render(<Page />); | ||
expect( | ||
screen.getByRole("heading", { level: 1, name: "Feat 1" }) | ||
).toBeDefined(); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
"use client"; | ||
|
||
import { useState } from "react"; | ||
|
||
function ToggleContent({ | ||
children, | ||
defaultShow = false, | ||
}: { | ||
children?: React.ReactNode; | ||
defaultShow?: boolean; | ||
}) { | ||
const [show, setShow] = useState(defaultShow); | ||
return ( | ||
<div> | ||
<button onClick={() => setShow(!show)}>Toggle</button> | ||
{show ? children : null} | ||
</div> | ||
); | ||
} | ||
|
||
export default function Page() { | ||
const ranNum = Math.round(Math.random() * 100); | ||
|
||
return ( | ||
<> | ||
<h1>Feat 1</h1> | ||
|
||
<ToggleContent> | ||
<p> | ||
<span>P1:</span> | ||
Lorem, ipsum dolor sit amet consectetur adipisicing elit. Dolorem, | ||
voluptatem mollitia suscipit odio eos fugiat eum in molestias itaque | ||
ex magni fuga deleniti dolores. Accusamus blanditiis reiciendis ab | ||
quibusdam saepe. | ||
</p> | ||
</ToggleContent> | ||
<ToggleContent> | ||
<p> | ||
<span>P2:</span> | ||
Lorem, ipsum dolor sit amet consectetur adipisicing elit. Dolorem, | ||
voluptatem mollitia suscipit odio eos fugiat eum in molestias itaque | ||
ex magni fuga deleniti dolores. Accusamus blanditiis reiciendis ab | ||
quibusdam saepe. | ||
</p> | ||
</ToggleContent> | ||
|
||
{ranNum > 50 && <p>Random number is greater than 50</p>} | ||
{ranNum <= 50 && <p>Random number is less than 50</p>} | ||
</> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters