Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
2b5f14c
Require Hello World in the document
acbart Jan 31, 2022
a7dee05
Rename text.Test.tsx to text.test.tsx
acbart Jan 31, 2022
3e381f3
Include the task info
acbart Jan 31, 2022
fee03d3
Merge branch 'task-first-branch' of https://github.com/UD-CISC275-S22…
acbart Jan 31, 2022
e6b1dab
Allow one or more instances of the Hello World text
acbart Feb 3, 2022
7a20734
Include json test command here
acbart Aug 24, 2024
7fe9ca3
Require Hello World in the document
acbart Jan 31, 2022
b8b8878
Include the task info
acbart Jan 31, 2022
fbdebde
Rename text.Test.tsx to text.test.tsx
acbart Jan 31, 2022
2f0146c
Allow one or more instances of the Hello World text
acbart Feb 3, 2022
a6acb43
Merge branch 'task-first-branch' of https://github.com/frontend-fun/t…
acbart Aug 24, 2024
ac36b32
First set of tests
acbart Jan 30, 2022
d04739d
Some logging tests
acbart Jan 30, 2022
b26100f
More html tests
acbart Jan 30, 2022
3bf4550
Fix the image test
acbart Jan 30, 2022
8dff2b6
Updated CSS tests, left a note about additional tests
acbart Jan 31, 2022
b66d4de
See previous commit message
acbart Jan 31, 2022
0a24364
Add in new css test
acbart Aug 24, 2024
4d43d7a
Add in points
acbart Aug 24, 2024
80f1cf6
Update HtmlCss.test.tsx
greglnelson Sep 17, 2024
51998ae
Update App.tsk
GraceC-326 Jan 25, 2026
fd7e95f
Update App.tsx
GraceC-326 Jan 25, 2026
d80798a
Update App.tsx
GraceC-326 Jan 25, 2026
9b837a7
Update App.tsx
GraceC-326 Jan 25, 2026
6c42bbd
Update App.tsx
GraceC-326 Jan 25, 2026
9f5f8e3
Update App.tsx
GraceC-326 Jan 25, 2026
e9fc53b
Update App.tsx
GraceC-326 Jan 25, 2026
b9d8b22
Update App.tsx
GraceC-326 Jan 25, 2026
4078686
Merge remote-tracking branch 'upstream/task-first-branch'
GraceC-326 Jan 25, 2026
ba1543c
Updated App.tsx
GraceC-326 Jan 25, 2026
1ef2347
Merge branch 'main' of https://github.com/GraceC-326/tasks
GraceC-326 Jan 25, 2026
a4233d7
Update package-lock.json
GraceC-326 Jan 25, 2026
2d1ad30
Merge remote-tracking branch 'upstream/task-html-css' into solved-htm…
GraceC-326 Jan 30, 2026
488e02b
Updated App.css/.tsx, Added one image
GraceC-326 Jan 30, 2026
d16e56e
Update App.tsx
GraceC-326 Jan 30, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
155 changes: 88 additions & 67 deletions package-lock.json

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"build": "react-scripts build",
"test": "react-scripts test",
"test:cov": "react-scripts test --coverage --watchAll",
"test:json": "react-scripts test --json --watchAll=false --outputFile jest-output.json --coverage",
"eject": "react-scripts eject",
"lint": "eslint ./src --ext .tsx --ext .ts --max-warnings 0",
"eslint-output": "eslint-output ./src --ext .tsx --ext .ts --max-warnings 0",
Expand Down
5 changes: 5 additions & 0 deletions public/tasks/task-first-branch.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Task - First Branch

Version: 0.0.1

Pass a short test to have certain text on the page.
5 changes: 5 additions & 0 deletions public/tasks/task-html-css.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Task - HTML/CSS

Version: 0.0.1

Add in some HTML and CSS, including a fancy looking button.
2 changes: 1 addition & 1 deletion src/App.css
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

.App-header {
width: 100%;
background-color: #282c34;
background-color: #6a6f79;
min-height: 40vh;
display: flex;
flex-direction: column;
Expand Down
31 changes: 31 additions & 0 deletions src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,47 @@
import React from "react";
import "./App.css";
import img from "./Daemon_bugInTheIce.jpg";
import { Button, Col, Container, Row } from "react-bootstrap";

function App(): React.JSX.Element {
return (
<div className="App">
<header className="App-header">
UM COS420 with React Hooks and TypeScript
</header>
<h1>Grace Cochran</h1>
<p>
Edit <code>src/App.tsx</code> and save. This page will
automatically reload.
</p>
<Button
onClick={() => {
console.log("Hello World!");
}}
>
Log Hello World
</Button>
<ol>
<li>
Step 1: Learn CSS, HTML, and JS/TS from this class and
others
</li>
<li>Step 2: Make a Neocities page with the knowledge gained</li>
<li>Step 3: Feel Self Fulfilled</li>
</ol>
<img
src={img}
style={{ width: "300px", height: "auto" }}
alt="An image of Daemon from the video game Date Everything. They are seen with their lower body stuck under a sheet of lake ice, a shocked expression on its face."
/>
<div style={{ width: 900, height: 40, backgroundColor: "red" }}>
<Container>
<Row>
<Col>Columns to</Col>
<Col> be colored red</Col>
</Row>
</Container>
</div>
</div>
);
}
Expand Down
Binary file added src/Daemon_bugInTheIce.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
83 changes: 83 additions & 0 deletions src/HtmlCss.test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
import React from "react";
import { render, screen } from "@testing-library/react";
import App from "./App";
import userEvent from "@testing-library/user-event";

describe("Some HTML Elements are added.", () => {
test("(2 pts) There is a heading", () => {
render(<App />);
const heading = screen.getAllByRole("heading");
expect(heading[0]).toBeInTheDocument();
});

test("(2 pts) There is an image with alt text", () => {
render(<App />);
const image = screen.getByRole("img");
expect(image).toBeInTheDocument();
expect(image).toHaveAttribute("alt");
});

test("(2 pts) There is a list with at least three elements", () => {
render(<App />);
const list = screen.getByRole("list");
expect(list).toBeInTheDocument();
expect(list.children.length).toBeGreaterThanOrEqual(3);
});
});

describe("(2 pts) Some basic CSS is added.", () => {
test("The background color of the header area is different", () => {
render(<App />);
const banner = screen.getByRole("banner");
expect(banner).not.toHaveStyle({
"background-color": "rgb(40, 44, 52)",
});
});
});

describe("(2 pts) Some Bootstrap Elements are added", () => {
test("There is one bootstrap button with the text 'Log Hello World'", () => {
render(<App />);
const button = screen.getByRole("button", { name: /Log Hello World/i });
expect(button).toBeInTheDocument();
expect(button).toHaveClass("btn");
expect(button).toHaveClass("btn-primary");
});

test("(2 pts) Not clicking the bootstrap button does not logs 'Hello World!'", () => {
const consoleSpy = jest.spyOn(console, "log");
render(<App />);
expect(consoleSpy).not.toHaveBeenCalledWith("Hello World!");
});

test("(2 pts) Clicking the bootstrap button logs 'Hello World!'", () => {
const consoleSpy = jest.spyOn(console, "log");
render(<App />);
const button = screen.getByRole("button", { name: /Log Hello World/i });
userEvent.click(button);
expect(consoleSpy).toHaveBeenCalledWith("Hello World!");
});
});

describe("Some additional CSS was added", () => {
test("(2 pts) checks if any element has a background color of red", () => {
const { container } = render(<App />);
// Get all elements in the rendered container
const elements = container.querySelectorAll("*");

// Check if any element has a background color of red
let foundRedBackground = false;

elements.forEach((element) => {
const style = getComputedStyle(element);
if (
style.backgroundColor === "red" ||
style.backgroundColor === "rgb(255, 0, 0)"
) {
foundRedBackground = true;
}
});

expect(foundRedBackground).toBe(true);
});
});
9 changes: 9 additions & 0 deletions src/text.test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import React from "react";
import { render, screen } from "@testing-library/react";
import App from "./App";

test("renders the text 'Hello World' somewhere", () => {
render(<App />);
const texts = screen.getAllByText(/Hello World/);
expect(texts.length).toBeGreaterThanOrEqual(1);
});