generated from hack4impact-calpoly/nextjs-app-template
-
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.
* commiting button and tests * added linkedin --------- Co-authored-by: Isha Varrier <ishavarrier@Ishas-MacBook-Air.local> Co-authored-by: Ryan Chan <91078767+ryanchansf@users.noreply.github.com>
- Loading branch information
1 parent
098323d
commit 891bd27
Showing
3 changed files
with
49 additions
and
0 deletions.
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
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,17 @@ | ||
"use client"; | ||
import React, { useState } from "react"; | ||
import { Button } from "@/components/ui/button"; | ||
|
||
export default function IshaVarrier() { | ||
const [count, setCount] = useState(0); | ||
const handleClick = () => { | ||
setCount(count + 1); | ||
}; | ||
|
||
return ( | ||
<div className="flex flex-col items-center justify-center h-screen"> | ||
<h1>Count Value: {count}</h1> | ||
<Button onClick={handleClick}>Click to Increment Count</Button> | ||
</div> | ||
); | ||
} |
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,31 @@ | ||
/** @jest-environment jsdom */ | ||
import IshaVarrier from "@/app/ishavarrier/page"; | ||
import "@testing-library/jest-dom"; | ||
import { render, screen } from "@testing-library/react"; | ||
import { fireEvent } from "@testing-library/react"; | ||
|
||
describe("Button Component", () => { | ||
it("should render the button component", () => { | ||
render(<IshaVarrier />); | ||
|
||
const button = screen.getByRole("button"); | ||
expect(button).toHaveTextContent("Click to Increment Count"); | ||
}); | ||
|
||
it("should render the heading component to display count", () => { | ||
render(<IshaVarrier />); | ||
|
||
expect(screen.getByText("Count Value: 0")).toBeInTheDocument(); | ||
}); | ||
|
||
it("should increment the count when button is clicked", () => { | ||
render(<IshaVarrier />); | ||
|
||
const button = screen.getByRole("button"); | ||
fireEvent.click(button); | ||
fireEvent.click(button); | ||
fireEvent.click(button); | ||
|
||
expect(screen.getByText("Count Value: 3")).toBeInTheDocument(); | ||
}); | ||
}); |