88} from "@site/src/components/conformance/types" ;
99import Heading from "@theme/Heading" ;
1010import styles from "./styles.module.css" ;
11+ import clsx from "clsx" ;
1112
1213type TestsGridProps = {
1314 state : ConformanceState ;
@@ -16,19 +17,23 @@ type TestsGridProps = {
1617} ;
1718
1819export default function TestsGrid ( props : TestsGridProps ) : JSX . Element {
20+ const [ hoverName , setHoverName ] = React . useState < undefined | String > ( )
1921 const cardBodyClass = "card__body " + styles . gridStyle ;
2022
23+ const title = hoverName ? "Test: " + hoverName : "Suite: " + props . suite . name ;
24+
2125 return (
2226 < div className = { styles . testGridCard } >
2327 < div className = "card" >
24- < div className = "card__header" >
25- < Heading as = "h3" > { props . suite . name } </ Heading >
28+ < div className = { clsx ( "card__header" , styles . testGridHeader ) } >
29+ < Heading as = "h3" > { title } </ Heading >
2630 </ div >
2731 < div className = { cardBodyClass } >
2832 < Grid
2933 tests = { props . suite . tests }
3034 esFlag = { props . state . ecmaScriptVersion }
3135 selectTest = { props . selectTest }
36+ setHoverValue = { ( name ) => setHoverName ( name ) }
3237 />
3338 </ div >
3439 </ div >
@@ -39,7 +44,8 @@ export default function TestsGrid(props: TestsGridProps): JSX.Element {
3944type GridProps = {
4045 tests : TestResult [ ] ;
4146 esFlag : string | null ;
42- selectTest : ( string ) => void ;
47+ selectTest : ( test : string ) => void ;
48+ setHoverValue : ( test : string | undefined ) => void ;
4349} ;
4450
4551function Grid ( props : GridProps ) : JSX . Element {
@@ -54,6 +60,7 @@ function Grid(props: GridProps): JSX.Element {
5460 key = { test . strict ? test . name + "-strict" : test . name }
5561 test = { test }
5662 selectTest = { props . selectTest }
63+ setHoverValue = { props . setHoverValue }
5764 />
5865 ) ;
5966 } )
@@ -63,6 +70,7 @@ function Grid(props: GridProps): JSX.Element {
6370 key = { test . strict ? test . name + "-strict" : test . name }
6471 test = { test }
6572 selectTest = { props . selectTest }
73+ setHoverValue = { props . setHoverValue }
6674 />
6775 ) ;
6876 } ) }
@@ -72,7 +80,8 @@ function Grid(props: GridProps): JSX.Element {
7280
7381type GridItemProps = {
7482 test : TestResult ;
75- selectTest : ( string ) => void ;
83+ selectTest : ( test : string ) => void ;
84+ setHoverValue : ( test : string | undefined ) => void ;
7685} ;
7786
7887function GridItem ( props : GridItemProps ) : JSX . Element {
@@ -93,6 +102,9 @@ function GridItem(props: GridItemProps): JSX.Element {
93102 < div
94103 className = { testResult }
95104 onClick = { ( ) => props . selectTest ( props . test . name + ".js" ) }
105+ onMouseEnter = { ( _e ) => props . setHoverValue ( props . test . name + ".js" ) }
106+ onMouseLeave = { ( _e ) => props . setHoverValue ( undefined ) }
107+ aria-label = { props . test . name }
96108 title = {
97109 props . test . strict
98110 ? "(strict) " + props . test . name + ".js"
0 commit comments