Skip to content

Solved forms #85

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 124 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
124 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
986b28a
First stab at questions
acbart Feb 2, 2022
e6b1dab
Allow one or more instances of the Hello World text
acbart Feb 3, 2022
2c852d6
Move Question interface to separate file
acbart Feb 6, 2022
dc3662a
Create answer interface
acbart Feb 8, 2022
51221ee
First stab at nested tasks
acbart Feb 8, 2022
3a793cc
Document Question interface
acbart Feb 9, 2022
5c39a97
Expand questions test data
acbart Feb 9, 2022
6ae0b6f
Add a little hint for a tough one
acbart Feb 9, 2022
b1bbbc8
Nested tests (phew)
acbart Feb 9, 2022
ab9bfb5
Basic starter files for components
acbart Feb 9, 2022
9765863
Another extra paren error
acbart Feb 9, 2022
d6c10cd
Merge branch 'main' of https://github.com/UD-CISC275-S22/react-typesc…
acbart Feb 13, 2022
c0bbc39
Updated, complete tests for all state components
acbart Feb 13, 2022
eb40f3e
Forgot task record for state
acbart Feb 19, 2022
6669ffa
First draft of components subtasks
acbart Feb 19, 2022
562f306
Another subtask, ChooseTeam
acbart Feb 24, 2022
4a34f5f
Oops order out of operations
acbart Feb 24, 2022
7327f4c
Add headers to each subtask
acbart Feb 24, 2022
cf7c212
Make testing easier for these components
acbart Feb 24, 2022
08feee1
Ugh this component is stupid, let's just forget about it for now
acbart Feb 24, 2022
89053a4
Provide the tests for the bad components
acbart Feb 24, 2022
41387d3
First stab at form task components
acbart Feb 25, 2022
1b03faf
Provide tests, change addQuestion to changeColor
acbart Feb 27, 2022
43b41ec
Fix entering blank text for GiveAttempts
acbart Mar 10, 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
83c4461
Basic functions tests and stubs
acbart Jan 30, 2022
a486530
Fix test organization
acbart Jan 30, 2022
9722564
Fix issue in fahrenheit conversion
acbart Jan 30, 2022
bd06d5d
Move around some of the functions
acbart Feb 3, 2022
4cd1900
Explain what the actual functions require you to do
acbart Feb 3, 2022
cf1d21a
Update formatting
acbart Aug 24, 2024
e11693a
Add in points
acbart Aug 24, 2024
7cc4e3f
First stab at array problems
acbart Feb 1, 2022
f253337
Add in the rest of the tests
acbart Feb 1, 2022
b8777b1
Fix question text
acbart Feb 1, 2022
f87771e
Update arrays.test.ts
acbart Feb 11, 2022
f0d316b
Add in points
acbart Aug 24, 2024
c2e556d
First stab at questions
acbart Feb 2, 2022
406ffb2
Move Question interface to separate file
acbart Feb 6, 2022
9b9adb6
Fix formatting
acbart Aug 24, 2024
3660252
First stab at questions
acbart Feb 2, 2022
09d3d4f
Move Question interface to separate file
acbart Feb 6, 2022
9a24024
Create answer interface
acbart Feb 8, 2022
879fe17
First stab at nested tasks
acbart Feb 8, 2022
4d29d21
Document Question interface
acbart Feb 9, 2022
d71d9fc
Expand questions test data
acbart Feb 9, 2022
c955718
Add a little hint for a tough one
acbart Feb 9, 2022
c574699
Nested tests (phew)
acbart Feb 9, 2022
a368ad0
Forgot the task record!
acbart Feb 19, 2022
304184e
Fix typo in editOption test, and missing return type for editOption
acbart Mar 1, 2022
1b76b80
Fix formatting
acbart Aug 24, 2024
23314f3
update point values for tests
acbart Aug 24, 2024
82faacc
Fix react return value
acbart Aug 24, 2024
cc7d4db
Update react tests to use async
acbart Aug 24, 2024
c419dc9
Fix linting
acbart Aug 24, 2024
444b03b
Merge branch 'task-state' into task-components
acbart Aug 24, 2024
c1aab28
Merge branch 'update-branches' into task-components
acbart Aug 24, 2024
50a9c85
Update for new react
acbart Aug 24, 2024
28ee8d2
Merge branch 'task-components' into task-forms
acbart Aug 24, 2024
084abb4
Update the code for new version of react
acbart Aug 24, 2024
c95dc0f
This one too
acbart Aug 24, 2024
3119c0f
Add in points
acbart Aug 24, 2024
e1134d8
Added name to App
Aug 28, 2024
40a5569
git/package
Aug 29, 2024
57a7090
fixed deploy.yml
Aug 29, 2024
024b243
.
Aug 30, 2024
7cfa6d8
Merge remote-tracking branch 'upstream/task-first-branch' into solved…
Sep 4, 2024
da50684
Added Hello World in new Div tag
Sep 4, 2024
d3dbea8
Merge remote-tracking branch 'upstream/task-first-branch' into solved…
Sep 4, 2024
db3648e
Added Hello World in a div tag
Sep 4, 2024
b22f9de
Merge branch 'solved-first-branch' of https://github.com/13KaranSingh…
Sep 4, 2024
ae38ce0
Merge remote-tracking branch 'upstream/task-html-css' into solved-htm…
Sep 5, 2024
2839755
Basic HTML and CSS Task
Sep 5, 2024
9d9eefd
Merge remote-tracking branch 'upstream/task-functions' into solved-fu…
Sep 9, 2024
14ef6f8
Edited the functions.ts file
Sep 9, 2024
e50c0f8
Merge remote-tracking branch 'upstream/task-arrays' into solved-arrays
Sep 11, 2024
b8c0c55
Did 5 functions so far
Sep 12, 2024
fc90ada
Finished rest of functions
Sep 12, 2024
3512c7b
Merge remote-tracking branch 'upstream/task-objects' into solved-objects
Sep 14, 2024
d34797f
Finished objects.ts
Sep 16, 2024
f5799c2
Fixed isValid function
Sep 16, 2024
fbce3c3
Trying to fix linting error
Sep 16, 2024
290ee15
trying to fix linting still
Sep 16, 2024
ba76328
Debugging
Sep 16, 2024
e20fb52
isValid
Sep 16, 2024
6e1afc3
isValid linting
Sep 16, 2024
5125c2b
Merge remote-tracking branch 'upstream/task-nested' into solved-nested
Sep 18, 2024
63a533a
did 3 function in nested.ts
Sep 18, 2024
18a0e8f
Fixed questions.json file
Sep 19, 2024
7cb08cd
Finished nested.ts
Sep 20, 2024
63d74a6
Merge remote-tracking branch 'upstream/task-state' into solved-state
Sep 23, 2024
4020170
Merge remote-tracking branch 'upstream/task-state' into solved-nested
Sep 23, 2024
7f2015f
merge conflics
Sep 23, 2024
691aa89
Merged nested into state
Sep 24, 2024
bb36825
finished components
Sep 24, 2024
bc09cf1
linting error
Sep 24, 2024
b3bd1e1
fixed TwoDice
Sep 24, 2024
9cdee19
TwoDice.tsx
Sep 24, 2024
41ed427
fixed some errors
Sep 24, 2024
188ba87
twoDice some fixes
Sep 24, 2024
8b28123
linitn error
Sep 24, 2024
5381ff7
trying to fix twoDice.tsx
Sep 24, 2024
e5c2abd
finished TwoDice
Sep 24, 2024
5a25a93
fixed
Sep 24, 2024
4109d11
fixed all bad components
Sep 24, 2024
d787a4e
fixed merge issue
Sep 27, 2024
6c7bacd
fixed branch, redid compontents
Sep 28, 2024
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
50 changes: 50 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
{
"env": {
"browser": true,
"es2021": true,
"node": true
},
"settings": {
"react": {
"version": "detect"
}
},
"extends": [
"eslint:recommended",
"plugin:react/recommended",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended",
"prettier"
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaFeatures": {
"jsx": true
},
"ecmaVersion": 12,
"sourceType": "module"
},
"plugins": ["react", "@typescript-eslint", "prettier"],
"rules": {
"prettier/prettier": [
"error",
{
"endOfLine": "auto"
}
],
"no-extra-parens": [
"warn",
"all",
{
"nestedBinaryExpressions": false,
"returnAssign": false,
"enforceForArrowConditionals": false,
"ignoreJSX": "all"
}
],
"brace-style": ["error", "1tbs"],
"indent": ["error", 4],
"quotes": ["error", "double"],
"semi": ["error", "always"]
}
}
5 changes: 5 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@ concurrency:
jobs:
deploy:
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [22.x]

steps:
- name: Checkout
uses: actions/checkout@v4
Expand Down
Empty file added git
Empty file.
123 changes: 57 additions & 66 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-arrays.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Task - Arrays

Version: 0.0.1

Implement functions that work with arrays immutably.
5 changes: 5 additions & 0 deletions public/tasks/task-components.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Task - Components

Version: 0.0.1

Fix some components that are using state incorrectly.
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-functions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Task - Functions

Version: 0.0.1

Implement a bunch of functions that work on primitives.
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.
5 changes: 5 additions & 0 deletions public/tasks/task-nested.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Task - Nested

Version: 0.0.1

Implement functions that work with nested arrays and objects immutably.
5 changes: 5 additions & 0 deletions public/tasks/task-objects.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Task - Objects

Version: 0.0.1

Implement functions that work with objects immutably.
5 changes: 5 additions & 0 deletions public/tasks/task-state.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Task - State

Version: 0.0.1

Create some new components that have React State.
93 changes: 91 additions & 2 deletions src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,105 @@
import React from "react";
import "./App.css";
import { ChangeType } from "./components/ChangeType";
import { RevealAnswer } from "./components/RevealAnswer";
import { StartAttempt } from "./components/StartAttempt";
import { TwoDice } from "./components/TwoDice";
import { CycleHoliday } from "./components/CycleHoliday";
import { Counter } from "./components/Counter";
import { DoubleHalf } from "./bad-components/DoubleHalf";
import { ColoredBox } from "./bad-components/ColoredBox";
import { ShoveBox } from "./bad-components/ShoveBox";
import { ChooseTeam } from "./bad-components/ChooseTeam";
import { Button, Col, Container, Row } from "react-bootstrap";
import { ChangeColor } from "./form-components/ChangeColor";
import { CheckAnswer } from "./form-components/CheckAnswer";
import { EditMode } from "./form-components/EditMode";
import { GiveAttempts } from "./form-components/GiveAttempts";
import { MultipleChoiceQuestion } from "./form-components/MultipleChoiceQuestion";

function App(): React.JSX.Element {
return (
<div className="App">
<header className="App-header">
UD CISC275 with React Hooks and TypeScript
<header style={{ color: "red" }} className="App-header">
<h1>
UD CISC275 with React Hooks and TypeScript. Karanvir Singh
</h1>
</header>
<div>Hello World</div>
<p>
Edit <code>src/App.tsx</code> and save. This page will
automatically reload.
</p>
<img src="https://google.com" alt="this is an image of a cat" />
<ol>
<li>Wake up</li>
<li>Brush Teeth</li>
<li>Shower</li>
</ol>
<Button
onClick={() => {
console.log("Hello World!");
}}
>
Log Hello World
</Button>

<Container>
<Row>
<Col>
<div
style={{
width: "100%",
height: "100px",
backgroundColor: "red",
}}
></div>
</Col>
<Col>
<div
style={{
width: "100%",
height: "100px",
backgroundColor: "red",
}}
></div>
</Col>
<Col>
<div
style={{
width: "100%",
height: "100px",
backgroundColor: "red",
}}
></div>
</Col>
</Row>
</Container>
<hr></hr>
<DoubleHalf></DoubleHalf>
<hr></hr>
<ChooseTeam></ChooseTeam>
<hr></hr>
<ColoredBox></ColoredBox>
<hr></hr>
<ShoveBox></ShoveBox>
<hr></hr>
<Counter></Counter>
<hr />
<RevealAnswer></RevealAnswer>
<hr />
<StartAttempt></StartAttempt>
<hr />
<TwoDice></TwoDice>
<hr />
<ChangeType></ChangeType>
<hr />
<CycleHoliday></CycleHoliday>
<ChangeColor></ChangeColor>
<CheckAnswer expectedAnswer={""}></CheckAnswer>
<EditMode></EditMode>
<GiveAttempts></GiveAttempts>
<MultipleChoiceQuestion options={[]} expectedAnswer={""}></MultipleChoiceQuestion>
</div>
);
}
Expand Down
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 header", () => {
render(<App />);
const header = screen.getByRole("heading");
expect(header).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);
});
});
Loading