Fixed ESLint errors
This commit is contained in:
parent
0d10d886c0
commit
242fc3b2f2
|
@ -1,7 +1,8 @@
|
|||
{
|
||||
"env": {
|
||||
"browser": true,
|
||||
"es2021": true
|
||||
"es2021": true,
|
||||
"jest": true
|
||||
},
|
||||
"extends": [
|
||||
"eslint:recommended",
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
// Import React
|
||||
import React, { useState } from "react";
|
||||
import React, { useState } from 'react';
|
||||
|
||||
// Next components
|
||||
import Image from "next/image";
|
||||
import Image from 'next/image';
|
||||
|
||||
// Styles
|
||||
import styles from "../../styles/List.module.css";
|
||||
import styles from '../../styles/List.module.css';
|
||||
|
||||
const star = "/images/star.png";
|
||||
const starFilled = "/images/starFilled.png";
|
||||
const star = '/images/star.png';
|
||||
const starFilled = '/images/starFilled.png';
|
||||
|
||||
// Element returns what should be displayed for each element of the list
|
||||
export default function Element({ element }) {
|
||||
|
@ -32,7 +32,7 @@ export default function Element({ element }) {
|
|||
|
||||
<div className={styles.txt}>
|
||||
<h1>{element.name}</h1>
|
||||
<p>{element.muscleGroups.join(", ")}</p>
|
||||
<p>{element.muscleGroups.join(', ')}</p>
|
||||
</div>
|
||||
|
||||
<div className={styles.star}>
|
||||
|
|
|
@ -1,26 +1,26 @@
|
|||
import { fireEvent, render, screen } from "@testing-library/react";
|
||||
import Element from "./Element";
|
||||
import Workout from "../../public/classes/Workout";
|
||||
import { fireEvent, render, screen } from '@testing-library/react';
|
||||
import Element from './Element';
|
||||
import Workout from '../../public/classes/Workout';
|
||||
|
||||
const toggleImgPath = (src) => {
|
||||
return src.includes("star.png")
|
||||
? "/images/starFilled.png"
|
||||
: "/images/star.png";
|
||||
return src.includes('star.png')
|
||||
? '/images/starFilled.png'
|
||||
: '/images/star.png';
|
||||
};
|
||||
|
||||
describe("The Favourite button", () => {
|
||||
it("Toggles on and off when clicked", () => {
|
||||
const element = new Workout("Pull Workout", ["Back", "Biceps", "Abs"]);
|
||||
describe('The Favourite button', () => {
|
||||
it('Toggles on and off when clicked', () => {
|
||||
const element = new Workout('Pull Workout', ['Back', 'Biceps', 'Abs']);
|
||||
render(<Element element={element} />);
|
||||
|
||||
let favBtn = screen.getByRole("button");
|
||||
let expectedImgPath = toggleImgPath(favBtn.getAttribute("src"));
|
||||
let favBtn = screen.getByRole('button');
|
||||
let expectedImgPath = toggleImgPath(favBtn.getAttribute('src'));
|
||||
|
||||
fireEvent.click(favBtn);
|
||||
expect(favBtn).toHaveAttribute("src", expectedImgPath);
|
||||
expect(favBtn).toHaveAttribute('src', expectedImgPath);
|
||||
|
||||
expectedImgPath = toggleImgPath(favBtn.getAttribute("src"));
|
||||
expectedImgPath = toggleImgPath(favBtn.getAttribute('src'));
|
||||
fireEvent.click(favBtn);
|
||||
expect(favBtn).toHaveAttribute("src", expectedImgPath);
|
||||
expect(favBtn).toHaveAttribute('src', expectedImgPath);
|
||||
});
|
||||
});
|
||||
|
|
|
@ -1,18 +1,18 @@
|
|||
import SearchFilterBar from "./SearchFilterBar";
|
||||
import Element from "./Element";
|
||||
import styles from "../../styles/List.module.css";
|
||||
import SearchFilterBar from './SearchFilterBar';
|
||||
import Element from './Element';
|
||||
import styles from '../../styles/List.module.css';
|
||||
|
||||
// React Bootstrap Components
|
||||
import ToggleButton from "react-bootstrap/ToggleButton";
|
||||
import ToggleButtonGroup from "react-bootstrap/ToggleButtonGroup";
|
||||
import ToggleButton from 'react-bootstrap/ToggleButton';
|
||||
import ToggleButtonGroup from 'react-bootstrap/ToggleButtonGroup';
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param {*} list A list of either workouts or exercises
|
||||
* @param {*} listType Either "radio" or "checkbox".
|
||||
* @param {*} selected State of which elements are selected. if checkbox, must be an array.
|
||||
* @param {*} setSelected The function that sets the state of selected
|
||||
* @returns
|
||||
* @returns
|
||||
*/
|
||||
export default function List({ list, listType, selected, setSelected }) {
|
||||
const handleChange = (e) => {
|
||||
|
|
|
@ -1,12 +1,8 @@
|
|||
import React from "react";
|
||||
import React from 'react';
|
||||
|
||||
// Bootstrap components
|
||||
import Form from "react-bootstrap/Form";
|
||||
import InputGroup from "react-bootstrap/InputGroup";
|
||||
import Dropdown from "react-bootstrap/Dropdown";
|
||||
import ButtonGroup from "react-bootstrap/ButtonGroup";
|
||||
import Button from "react-bootstrap/Button";
|
||||
import { DropdownButton } from "react-bootstrap";
|
||||
import Form from 'react-bootstrap/Form';
|
||||
import InputGroup from 'react-bootstrap/InputGroup';
|
||||
|
||||
export default function SearchFilterBar() {
|
||||
return (
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
// Next components
|
||||
import Link from "next/link";
|
||||
import Link from 'next/link';
|
||||
|
||||
// Bootstrap components
|
||||
import Nav from "react-bootstrap/Nav";
|
||||
import Navbar from "react-bootstrap/Navbar";
|
||||
import Nav from 'react-bootstrap/Nav';
|
||||
import Navbar from 'react-bootstrap/Navbar';
|
||||
|
||||
// Styles
|
||||
import styles from "../../styles/Navbar.module.css";
|
||||
import styles from '../../styles/Navbar.module.css';
|
||||
|
||||
function TopNavbar() {
|
||||
return (
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
import { fireEvent, render, screen } from "@testing-library/react";
|
||||
import React from "react";
|
||||
import WorkoutsPage from "../pages/workouts/index";
|
||||
import { fireEvent, render, screen } from '@testing-library/react';
|
||||
import React from 'react';
|
||||
import WorkoutsPage from '../pages/workouts/index';
|
||||
|
||||
describe("The List of buttons displaying Workouts or Exercises", () => {
|
||||
it("Updates the selected button when another is clicked in the Radio List", () => {
|
||||
describe('The List of buttons displaying Workouts or Exercises', () => {
|
||||
it('Updates the selected button when another is clicked in the Radio List', () => {
|
||||
render(<WorkoutsPage />);
|
||||
|
||||
let btns = screen.getAllByRole("radio");
|
||||
let btns = screen.getAllByRole('radio');
|
||||
|
||||
btns.forEach((btn1) => {
|
||||
fireEvent.click(btn1);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import "bootstrap/dist/css/bootstrap.min.css";
|
||||
import "../styles/globals.css";
|
||||
import { SSRProvider } from "react-aria";
|
||||
import 'bootstrap/dist/css/bootstrap.min.css';
|
||||
import '../styles/globals.css';
|
||||
import { SSRProvider } from 'react-aria';
|
||||
|
||||
function MyApp({ Component, pageProps }) {
|
||||
return (
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
// Next.js components
|
||||
import Link from "next/link";
|
||||
import Link from 'next/link';
|
||||
|
||||
// Bootstrap components
|
||||
import TopNavbar from "../../components/Navbar/Navbar";
|
||||
import TopNavbar from '../../components/Navbar/Navbar';
|
||||
|
||||
// Styles
|
||||
import styles from "../../styles/Exercises.module.css";
|
||||
import styles from '../../styles/Exercises.module.css';
|
||||
|
||||
export default function ExercisesPage() {
|
||||
return (
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
// Next.js components
|
||||
import Head from "next/head";
|
||||
import Link from "next/link";
|
||||
import Head from 'next/head';
|
||||
import Link from 'next/link';
|
||||
|
||||
// Bootstrap components
|
||||
import TopNavbar from "../components/Navbar/Navbar";
|
||||
import TopNavbar from '../components/Navbar/Navbar';
|
||||
|
||||
// Styles
|
||||
import styles from "../styles/Home.module.css";
|
||||
import styles from '../styles/Home.module.css';
|
||||
|
||||
export default function Home() {
|
||||
return (
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
// Next.js components
|
||||
import Link from "next/link";
|
||||
import Link from 'next/link';
|
||||
|
||||
// Bootstrap components
|
||||
import TopNavbar from "../../components/Navbar/Navbar";
|
||||
import TopNavbar from '../../components/Navbar/Navbar';
|
||||
|
||||
// Styles
|
||||
import styles from "../../styles/Profile.module.css";
|
||||
import styles from '../../styles/Profile.module.css';
|
||||
|
||||
export default function ProfilePage() {
|
||||
return (
|
||||
|
|
|
@ -1,39 +1,39 @@
|
|||
// Next.js components
|
||||
import Link from "next/link";
|
||||
import Link from 'next/link';
|
||||
|
||||
// React
|
||||
import React, { useState } from "react";
|
||||
import React, { useState } from 'react';
|
||||
|
||||
// Bootstrap components
|
||||
import TopNavbar from "../../components/Navbar/Navbar";
|
||||
import List from "../../components/List/List";
|
||||
import TopNavbar from '../../components/Navbar/Navbar';
|
||||
import List from '../../components/List/List';
|
||||
|
||||
// Styles
|
||||
import styles from "../../styles/Workouts.module.css";
|
||||
import styles from '../../styles/Workouts.module.css';
|
||||
|
||||
// Import the Workout class so that we can create a dummy set of workouts to render
|
||||
import Workout from "../../public/classes/Workout";
|
||||
import Workout from '../../public/classes/Workout';
|
||||
|
||||
// A dummy workout list so that we have data to render.
|
||||
// Once the database is implemented this will not be necessary
|
||||
const workout_list = [];
|
||||
workout_list.push(
|
||||
new Workout("Push Workout", ["Chest", "Shoulder", "Triceps"])
|
||||
new Workout('Push Workout', ['Chest', 'Shoulder', 'Triceps'])
|
||||
);
|
||||
workout_list.push(new Workout("Pull Workout", ["Back", "Biceps", "Abs"]));
|
||||
workout_list.push(new Workout('Pull Workout', ['Back', 'Biceps', 'Abs']));
|
||||
workout_list.push(
|
||||
new Workout("Legs Workout", ["Quadriceps", "Hamstrings", "Calves"])
|
||||
new Workout('Legs Workout', ['Quadriceps', 'Hamstrings', 'Calves'])
|
||||
);
|
||||
workout_list.push(
|
||||
new Workout("Upper Workout", ["Chest", "Back", "Shoulder", "Triceps"])
|
||||
new Workout('Upper Workout', ['Chest', 'Back', 'Shoulder', 'Triceps'])
|
||||
);
|
||||
workout_list.push(new Workout("Workout 1", ["Chest", "Shoulder", "Triceps"]));
|
||||
workout_list.push(new Workout("Workout 2", ["Back", "Biceps", "Abs"]));
|
||||
workout_list.push(new Workout('Workout 1', ['Chest', 'Shoulder', 'Triceps']));
|
||||
workout_list.push(new Workout('Workout 2', ['Back', 'Biceps', 'Abs']));
|
||||
workout_list.push(
|
||||
new Workout("Workout 3", ["Quadriceps", "Hamstrings", "Calves"])
|
||||
new Workout('Workout 3', ['Quadriceps', 'Hamstrings', 'Calves'])
|
||||
);
|
||||
workout_list.push(
|
||||
new Workout("Workout 4", ["Chest", "Back", "Shoulder", "Triceps"])
|
||||
new Workout('Workout 4', ['Chest', 'Back', 'Shoulder', 'Triceps'])
|
||||
);
|
||||
|
||||
export default function WorkoutsPage() {
|
||||
|
|
Loading…
Reference in New Issue