@@ -54,23 +54,33 @@ describe("ItemRow", () => {
5454 screen . getByTestId ( "child-slot" ) ;
5555 } ) ;
5656
57+ it ( "children slot sits above overlay link (relative z-10)" , ( ) => {
58+ const { container } = render ( ( ) => (
59+ < ItemRow { ...defaultProps } >
60+ < span data-testid = "child-slot" > extra content</ span >
61+ </ ItemRow >
62+ ) ) ;
63+ const childWrapper = container . querySelector ( "[data-testid='child-slot']" ) ! . parentElement ! ;
64+ expect ( childWrapper . className ) . toContain ( "relative" ) ;
65+ expect ( childWrapper . className ) . toContain ( "z-10" ) ;
66+ } ) ;
67+
5768 it ( "does not render children slot when not provided" , ( ) => {
5869 render ( ( ) => < ItemRow { ...defaultProps } /> ) ;
5970 expect ( screen . queryByTestId ( "child-slot" ) ) . toBeNull ( ) ;
6071 } ) ;
6172
62- it ( "title is a real link with correct href and target " , ( ) => {
73+ it ( "renders overlay link with correct href, target, rel, and aria-label " , ( ) => {
6374 render ( ( ) => < ItemRow { ...defaultProps } /> ) ;
64- const link = screen . getByText ( " Fix a bug" ) . closest ( "a" ) ! ;
75+ const link = screen . getByRole ( "link" , { name : / o c t o c a t \/ H e l l o - W o r l d # 4 2 : F i x a b u g / } ) ;
6576 expect ( link . getAttribute ( "href" ) ) . toBe ( defaultProps . url ) ;
6677 expect ( link . getAttribute ( "target" ) ) . toBe ( "_blank" ) ;
6778 expect ( link . getAttribute ( "rel" ) ) . toBe ( "noopener noreferrer" ) ;
6879 } ) ;
6980
70- it ( "title link has no href for non-GitHub URLs" , ( ) => {
81+ it ( "does not render overlay link for non-GitHub URLs" , ( ) => {
7182 render ( ( ) => < ItemRow { ...defaultProps } url = "https://evil.com/bad" /> ) ;
72- const link = screen . getByText ( "Fix a bug" ) . closest ( "a" ) ! ;
73- expect ( link . getAttribute ( "href" ) ) . toBeNull ( ) ;
83+ expect ( screen . queryByRole ( "link" ) ) . toBeNull ( ) ;
7484 } ) ;
7585
7686 it ( "calls onIgnore when ignore button is clicked" , async ( ) => {
@@ -84,15 +94,11 @@ describe("ItemRow", () => {
8494 expect ( onIgnore ) . toHaveBeenCalledOnce ( ) ;
8595 } ) ;
8696
87- it ( "ignore button does not navigate (sits above stretched link)" , async ( ) => {
88- const user = userEvent . setup ( ) ;
89- const onIgnore = vi . fn ( ) ;
90- render ( ( ) => < ItemRow { ...defaultProps } onIgnore = { onIgnore } /> ) ;
91-
97+ it ( "ignore button has relative z-10 to sit above overlay link" , ( ) => {
98+ render ( ( ) => < ItemRow { ...defaultProps } /> ) ;
9299 const ignoreBtn = screen . getByLabelText ( / I g n o r e # 4 2 / i) ;
93- await user . click ( ignoreBtn ) ;
94-
95- expect ( onIgnore ) . toHaveBeenCalledOnce ( ) ;
100+ expect ( ignoreBtn . className ) . toContain ( "relative" ) ;
101+ expect ( ignoreBtn . className ) . toContain ( "z-10" ) ;
96102 } ) ;
97103
98104 it ( "applies compact padding in compact density" , ( ) => {
0 commit comments