Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 | 41x 41x 41x 41x 16x 41x 41x 40x 93x 41x 6x | import { useState } from "react";
import { Form } from "react-bootstrap";
function SchoolsDropdown({ schools , initialContents}){
// Stryker disable next-line all : don't test useState
const [isActive, setIsActive] = useState();
const testId = "FormSelect";
let initialSchool = null;
if(initialContents){
initialSchool = initialContents.school;
}
let schoolOptions = null;
if(schools){
schoolOptions = schools.map((school) =>
<option
key = {school.abbrev}
data-testid={`${testId}-option-${school.abbrev}`}
>
{school.abbrev}
</option>);
}
return(
<Form.Select
id = "FormSelect"
data-testid = "FormSelect"
value = { isActive || initialSchool || "No school selected" }
onChange = { option => setIsActive(option.target.value)}
>
<option
key = "No school selected"
disabled = {true}
data-testid={`${testId}-option-No school selected`}
>
No school selected
</option>
{ schoolOptions }
</Form.Select>
)
}
export default SchoolsDropdown; |