File tree Expand file tree Collapse file tree
app/javascript/Components Expand file tree Collapse file tree Original file line number Diff line number Diff line change 4141- Added additional details to the account settings and renamed the Settings dropdown to Account (#8207 )
4242
4343### 🐛 Bug fixes
44+ - Fixed inline help icons not appearing in the Graders tab and starter file settings (#8316 )
4445- Fixed graders not being assigned to groups whose submissions have not been collected when skipping groups with empty submissions (#8315 )
4546- Fixed an error when changing an annotation's deduction on a result with no mark yet for the annotation category's criterion (#8313 )
4647- Fixed active marking criteria re-expanding immediately after being collapsed (#8309 )
Original file line number Diff line number Diff line change 1+ import React , { useState } from "react" ;
2+ import { FontAwesomeIcon } from "@fortawesome/react-fontawesome" ;
3+ import { faCircleQuestion } from "@fortawesome/free-regular-svg-icons" ;
4+
5+ /**
6+ * A help icon that toggles the display of its help text when clicked.
7+ *
8+ * This is the React equivalent of the `.inline-help` markup used in ERB views. Those elements are
9+ * set up by `common/help-system.js` when the page loads, which runs before React components render.
10+ */
11+ export default function InlineHelp ( { children} ) {
12+ const [ isOpen , setIsOpen ] = useState ( false ) ;
13+
14+ return (
15+ < div className = "inline-help" onClick = { ( ) => setIsOpen ( open => ! open ) } >
16+ < FontAwesomeIcon icon = { faCircleQuestion } />
17+ < p style = { { display : isOpen ? "block" : "none" } } > { children } </ p >
18+ </ div >
19+ ) ;
20+ }
Original file line number Diff line number Diff line change 1+ import InlineHelp from "../Helpers/inline_help" ;
2+ import { render , screen , fireEvent } from "@testing-library/react" ;
3+
4+ describe ( "InlineHelp" , ( ) => {
5+ let container ;
6+
7+ beforeEach ( ( ) => {
8+ ( { container} = render ( < InlineHelp > Some help text</ InlineHelp > ) ) ;
9+ } ) ;
10+
11+ it ( "renders a help icon" , ( ) => {
12+ expect ( container . querySelector ( ".inline-help svg.fa-circle-question" ) ) . toBeInTheDocument ( ) ;
13+ } ) ;
14+
15+ it ( "hides the help text initially" , ( ) => {
16+ expect ( screen . getByText ( "Some help text" ) ) . not . toBeVisible ( ) ;
17+ } ) ;
18+
19+ it ( "shows the help text when clicked" , ( ) => {
20+ fireEvent . click ( container . querySelector ( ".inline-help" ) ) ;
21+ expect ( screen . getByText ( "Some help text" ) ) . toBeVisible ( ) ;
22+ } ) ;
23+
24+ it ( "hides the help text when clicked again" , ( ) => {
25+ const help = container . querySelector ( ".inline-help" ) ;
26+ fireEvent . click ( help ) ;
27+ fireEvent . click ( help ) ;
28+ expect ( screen . getByText ( "Some help text" ) ) . not . toBeVisible ( ) ;
29+ } ) ;
30+ } ) ;
Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ import {FontAwesomeIcon} from "@fortawesome/react-fontawesome";
66import Table from "./table/table" ;
77import { createColumnHelper } from "@tanstack/react-table" ;
88import { caseSensitiveIncludes } from "./Helpers/table_helpers" ;
9+ import InlineHelp from "./Helpers/inline_help" ;
910import { GraderDistributionModal } from "./Modals/graders_distribution_modal" ;
1011import { SectionDistributionModal } from "./Modals/section_distribution_modal" ;
1112
@@ -371,9 +372,7 @@ class GradersManager extends React.Component {
371372 />
372373 { I18n . t ( "graders.skip_empty_submissions" ) }
373374 </ label >
374- < div className = "inline-help" >
375- < p > { I18n . t ( "graders.skip_empty_submissions_tooltip" ) } </ p >
376- </ div >
375+ < InlineHelp > { I18n . t ( "graders.skip_empty_submissions_tooltip" ) } </ InlineHelp >
377376 </ div >
378377 < div style = { { marginBottom : "1em" } } >
379378 < label >
Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ import FileUploadModal from "./Modals/file_upload_modal";
55import ReactTable from "react-table" ;
66import { FontAwesomeIcon } from "@fortawesome/react-fontawesome" ;
77import { flashMessage } from "../common/flash" ;
8+ import InlineHelp from "./Helpers/inline_help" ;
89
910function blurOnEnter ( event ) {
1011 if ( event . key === "Enter" ) {
@@ -477,9 +478,7 @@ class StarterFileManager extends React.Component {
477478 />
478479 { I18n . t ( "assignments.starter_file.available_after_due" ) }
479480 </ label >
480- < div className = "inline-help" >
481- < p > { I18n . t ( "assignments.starter_file.available_after_due_help" ) } </ p >
482- </ div >
481+ < InlineHelp > { I18n . t ( "assignments.starter_file.available_after_due_help" ) } </ InlineHelp >
483482 </ Fragment >
484483 ) ;
485484 } ;
You can’t perform that action at this time.
0 commit comments