diff --git a/FrontEndReact/src/View/Admin/Add/AddCourse/AdminAddCourse.js b/FrontEndReact/src/View/Admin/Add/AddCourse/AdminAddCourse.js index 0f4ddb821..3be2ad788 100644 --- a/FrontEndReact/src/View/Admin/Add/AddCourse/AdminAddCourse.js +++ b/FrontEndReact/src/View/Admin/Add/AddCourse/AdminAddCourse.js @@ -5,7 +5,8 @@ import validator from "validator"; import ErrorMessage from "../../../Error/ErrorMessage.js"; import { genericResourcePOST, genericResourcePUT } from "../../../../utility.js"; import Cookies from "universal-cookie"; -import { Box, Button, FormControl, Typography, TextField, FormControlLabel, Checkbox, FormGroup, } from "@mui/material"; +import HelpOutlineIcon from "@mui/icons-material/HelpOutline"; +import { Box, Button, FormControl, Typography, Popover, TextField, Tooltip, IconButton, FormControlLabel, Checkbox, FormGroup, } from "@mui/material"; @@ -25,7 +26,8 @@ class AdminAddCourse extends Component { year: "", active: true, useTas: true, - useFixedTeams: true, + useFixedTeams: true, + anchorEl: null, errors: { courseName: "", @@ -34,8 +36,13 @@ class AdminAddCourse extends Component { year: "", }, }; + } + setAnchorEl = (element) => { + this.setState({ anchorEl: element }); + }; + componentDidMount() { var navbar = this.props.navbar; var state = navbar.state; @@ -56,6 +63,13 @@ class AdminAddCourse extends Component { }); } } + handleClick = (event) => { + this.setAnchorEl(event.currentTarget); + }; + + handleClose = () => { + this.setAnchorEl(null); + }; handleChange = (e) => { const { id, value } = e.target; @@ -144,9 +158,6 @@ class AdminAddCourse extends Component { if (term.trim() === "") newErrors["term"] = "Term cannot be empty"; - else if (term.trim() !== "Spring" && term.trim() !== "Fall" && term.trim() !== "Summer") - newErrors["term"] = "Term should be either Spring, Fall, or Summer"; - if (newErrors["courseName"] !== "" || newErrors["courseNumber"] !== "" ||newErrors["year"] !== "" ||newErrors["term"] !== "") { this.setState({ errors: newErrors @@ -208,6 +219,8 @@ class AdminAddCourse extends Component { var navbar = this.props.navbar; var state = navbar.state; var addCourse = state.addCourse; + const open = Boolean(this.state.anchorEl); + const id = open ? 'simple-popover' : undefined; return ( @@ -266,7 +279,7 @@ class AdminAddCourse extends Component { id="term" name="newTerm" variant="outlined" - label="Term" + label="Type your Term name here" fullWidth value={term} error={!!errors.term} @@ -344,8 +357,31 @@ class AdminAddCourse extends Component { } name="newFixedTeams" - label="Fixed Team" - /> + label="Fixed Teams" + /> +
+ + + + + +
+ + Active: Uncheck this box at the end of the term to move it to the Inactive Courses table.
+
Use TA's: + Will you use Teaching or Learning Assistants in this course to fill out rubrics?
+
Fixed teams: Do you assign students to the same team for the entire semester?
+
+ { - render(); - - await waitFor(() => { - expectElementWithAriaLabelToBeInDocument(ct); - }); - - clickElementWithAriaLabel(ac); - - await waitFor(() => { - expectElementWithAriaLabelToBeInDocument(act); - }); - - changeElementWithAriaLabelWithInput(cnami, "Object Oriented Programming"); - - changeElementWithAriaLabelWithInput(cnumi, "CS3423"); - - changeElementWithAriaLabelWithInput(cti, "A"); - - changeElementWithAriaLabelWithInput(cyi, "2025"); - - clickElementWithAriaLabel(aosacb); - - await waitFor(() => { - expectElementWithAriaLabelToBeInDocument(acf); - - expectElementWithAriaLabelToHaveErrorMessage(cti, "Term should be either Spring, Fall, or Summer"); - }); -}); - - -test("AdminAddCourse.test.js Test 9: HelperText error should show for the addCourseYear text field when input is less than 2023", async () => { +test("AdminAddCourse.test.js Test 8: HelperText error should show for the addCourseYear text field when input is less than 2023", async () => { render(); await waitFor(() => { @@ -287,7 +255,7 @@ test("AdminAddCourse.test.js Test 9: HelperText error should show for the addCou }); -test("AdminAddCourse.test.js Test 10: HelperText error should show for the addCourseYear text field when input is not a numeric value", async () => { +test("AdminAddCourse.test.js Test 9: HelperText error should show for the addCourseYear text field when input is not a numeric value", async () => { render(); await waitFor(() => { @@ -318,7 +286,7 @@ test("AdminAddCourse.test.js Test 10: HelperText error should show for the addCo }); -test("AdminAddCourse.test.js Test 11: Filling in valid input and clicking the Add Course button should redirect you to course view page, and should contain the new course you just added", async () => { +test("AdminAddCourse.test.js Test 10: Filling in valid input and clicking the Add Course button should redirect you to course view page, and should contain the new course you just added", async () => { render(); await waitFor(() => { @@ -354,7 +322,7 @@ test("AdminAddCourse.test.js Test 11: Filling in valid input and clicking the Ad }); }); -test("AdminAddCourse.test.js Test 12: HelperText errors should show for the addCourseYear and addCourseTerm text fields when the input year is not numeric and the term is not 'Spring', 'Fall', or 'Summer'", async () => { +test("AdminAddCourse.test.js Test 11: HelperText errors should show for the addCourseYear text field when the input year is not numeric", async () => { render(); await waitFor(() => { @@ -382,6 +350,5 @@ test("AdminAddCourse.test.js Test 12: HelperText errors should show for the addC expectElementWithAriaLabelToHaveErrorMessage(cyi, "Year must be a numeric value"); - expectElementWithAriaLabelToHaveErrorMessage(cti, "Term should be either Spring, Fall, or Summer"); }); }); \ No newline at end of file