• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

wger-project / react / 30927490800

04 Aug 2026 04:05PM UTC coverage: 78.695% (-0.2%) from 78.893%
30927490800

Pull #1294

github

web-flow
Merge 08790d1e8 into fa4b023be
Pull Request #1294: Fix development server lint warnings

2316 of 3231 branches covered (71.68%)

Branch coverage included in aggregate %.

14 of 19 new or added lines in 13 files covered. (73.68%)

2 existing lines in 2 files now uncovered.

4835 of 5856 relevant lines covered (82.56%)

33.99 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

48.28
/src/components/Exercises/forms/ExerciseNotes.tsx
1
import AddIcon from '@mui/icons-material/Add';
18✔
2
import DeleteIcon from '@mui/icons-material/Delete';
3
import { IconButton, InputAdornment, TextField } from "@mui/material";
4
import Grid from '@mui/material/Grid';
5
import { useField } from "formik";
6
import React, { useRef, useState } from "react";
7
import { useTranslation } from "react-i18next";
8

9
export function ExerciseNotes(props: { fieldName: string }) {
10
    const [t] = useTranslation();
580✔
11
    const [field, meta, helpers] = useField(props.fieldName);
580✔
12
    const [newNoteValue, setNewNoteValue] = useState<string>('');
580✔
13
    const noteKeys = useRef<string[]>(field.value.map(() => crypto.randomUUID()));
580✔
14

15
    const deleteAtIndex = (index: number) => {
580✔
NEW
16
        noteKeys.current.splice(index, 1);
×
UNCOV
17
        helpers.setValue(field.value.filter((_: string, b: number) => b !== index));
×
18
    };
19

20
    const setNoteValueIndex = (index: number, note: string) => {
580✔
21
        field.value[index] = note;
×
22
        helpers.setValue(field.value);
×
23
    };
24
    const addEntry = () => {
580✔
NEW
25
        noteKeys.current.push(crypto.randomUUID());
×
26
        field.value.push(newNoteValue);
×
27
        helpers.setValue(field.value);
×
28
        setNewNoteValue('');
×
29
    };
30

31
    return <>
580✔
32
        <Grid size={12}>
33
            <TextField
34
                fullWidth
35
                label={t('exercises.newNote')}
36
                sx={{ mb: 3 }}
37
                variant="standard"
38
                value={newNoteValue}
39
                onChange={event => setNewNoteValue(event.target.value)}
×
40
                error={meta.touched && Boolean(meta.error)}
586✔
41
                helperText={meta.touched && meta.error ? meta.error : t('exercises.notesHelpText')}
1,166!
42
                slotProps={{
43
                    input: {
44
                        endAdornment: (
45
                            <InputAdornment position="end">
46
                                <IconButton onClick={addEntry}>
47
                                    <AddIcon />
48
                                </IconButton>
49
                            </InputAdornment>
50
                        ),
51
                    },
52
                }}
53
            />
54
        </Grid>
55
        {field.value.map((note: string, index: number) =>
56
            <TextField
×
57
                key={noteKeys.current[index]}
58
                fullWidth
59
                value={note}
60
                onChange={(event) => setNoteValueIndex(index, event.target.value)}
×
61
                sx={{ mt: 2 }}
62
                variant="standard"
63
                error={meta.touched && Boolean(meta.error)}
×
64
                slotProps={{
65
                    input: {
66
                        endAdornment: (
67
                            <InputAdornment position="end">
68
                                <IconButton onClick={() => deleteAtIndex(index)}>
×
69
                                    <DeleteIcon />
70
                                </IconButton>
71
                            </InputAdornment>
72
                        ),
73
                    },
74
                }}
75

76
            />
77
        )}
78
    </>;
79
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc