File tree Expand file tree Collapse file tree 2 files changed +30
-1
lines changed
webview-ui/src/components/common Expand file tree Collapse file tree 2 files changed +30
-1
lines changed Original file line number Diff line number Diff line change @@ -45,7 +45,7 @@ const remarkUrlToLink = () => {
4545 children . push ( {
4646 type : "link" ,
4747 url : cleanedMatches [ i ] ,
48- children : [ { type : "text" , value : cleanedMatches [ i ] } ] ,
48+ children : [ { type : "text" , value : matches [ i ] } ] ,
4949 } )
5050 }
5151 } )
Original file line number Diff line number Diff line change 1+ import React from "react"
2+ import { render , screen } from "@testing-library/react"
3+ import MarkdownBlock from "../MarkdownBlock"
4+ import { vi } from "vitest"
5+
6+ vi . mock ( "@src/utils/vscode" , ( ) => ( {
7+ vscode : {
8+ postMessage : vi . fn ( ) ,
9+ } ,
10+ } ) )
11+
12+ vi . mock ( "@src/context/ExtensionStateContext" , ( ) => ( {
13+ useExtensionState : ( ) => ( {
14+ theme : "dark" ,
15+ } ) ,
16+ } ) )
17+
18+ describe ( "MarkdownBlock" , ( ) => {
19+ it ( "should correctly handle URLs with trailing punctuation" , async ( ) => {
20+ const markdown = "Check out this link: https://example.com."
21+ render ( < MarkdownBlock markdown = { markdown } /> )
22+
23+ await ( async ( ) => {
24+ const linkElement = screen . getByRole ( "link" )
25+ expect ( linkElement ) . toHaveAttribute ( "href" , "https://example.com" )
26+ expect ( linkElement . textContent ) . toBe ( "https://example.com." )
27+ } )
28+ } )
29+ } )
You can’t perform that action at this time.
0 commit comments