8
8
} from "@site/src/components/conformance/types" ;
9
9
import Heading from "@theme/Heading" ;
10
10
import styles from "./styles.module.css" ;
11
+ import clsx from "clsx" ;
11
12
12
13
type TestsGridProps = {
13
14
state : ConformanceState ;
@@ -16,19 +17,23 @@ type TestsGridProps = {
16
17
} ;
17
18
18
19
export default function TestsGrid ( props : TestsGridProps ) : JSX . Element {
20
+ const [ hoverName , setHoverName ] = React . useState < undefined | String > ( )
19
21
const cardBodyClass = "card__body " + styles . gridStyle ;
20
22
23
+ const title = hoverName ? "Test: " + hoverName : "Suite: " + props . suite . name ;
24
+
21
25
return (
22
26
< div className = { styles . testGridCard } >
23
27
< 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 >
26
30
</ div >
27
31
< div className = { cardBodyClass } >
28
32
< Grid
29
33
tests = { props . suite . tests }
30
34
esFlag = { props . state . ecmaScriptVersion }
31
35
selectTest = { props . selectTest }
36
+ setHoverValue = { ( name ) => setHoverName ( name ) }
32
37
/>
33
38
</ div >
34
39
</ div >
@@ -39,7 +44,8 @@ export default function TestsGrid(props: TestsGridProps): JSX.Element {
39
44
type GridProps = {
40
45
tests : TestResult [ ] ;
41
46
esFlag : string | null ;
42
- selectTest : ( string ) => void ;
47
+ selectTest : ( test : string ) => void ;
48
+ setHoverValue : ( test : string | undefined ) => void ;
43
49
} ;
44
50
45
51
function Grid ( props : GridProps ) : JSX . Element {
@@ -54,6 +60,7 @@ function Grid(props: GridProps): JSX.Element {
54
60
key = { test . strict ? test . name + "-strict" : test . name }
55
61
test = { test }
56
62
selectTest = { props . selectTest }
63
+ setHoverValue = { props . setHoverValue }
57
64
/>
58
65
) ;
59
66
} )
@@ -63,6 +70,7 @@ function Grid(props: GridProps): JSX.Element {
63
70
key = { test . strict ? test . name + "-strict" : test . name }
64
71
test = { test }
65
72
selectTest = { props . selectTest }
73
+ setHoverValue = { props . setHoverValue }
66
74
/>
67
75
) ;
68
76
} ) }
@@ -72,7 +80,8 @@ function Grid(props: GridProps): JSX.Element {
72
80
73
81
type GridItemProps = {
74
82
test : TestResult ;
75
- selectTest : ( string ) => void ;
83
+ selectTest : ( test : string ) => void ;
84
+ setHoverValue : ( test : string | undefined ) => void ;
76
85
} ;
77
86
78
87
function GridItem ( props : GridItemProps ) : JSX . Element {
@@ -93,6 +102,9 @@ function GridItem(props: GridItemProps): JSX.Element {
93
102
< div
94
103
className = { testResult }
95
104
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 }
96
108
title = {
97
109
props . test . strict
98
110
? "(strict) " + props . test . name + ".js"
0 commit comments