Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature]: allow html in html-report's annotation description #30983

Open
ppath opened this issue May 23, 2024 · 0 comments
Open

[Feature]: allow html in html-report's annotation description #30983

ppath opened this issue May 23, 2024 · 0 comments

Comments

@ppath
Copy link

ppath commented May 23, 2024

馃殌 Feature Request

Allow HTML rendering for annotation descriptions.

Maybe something like:

---- a/packages/html-reporter/src/testCaseView.tsx
+++ b/packages/html-reporter/src/testCaseView.tsx
@@ -69,14 +69,14 @@ function renderAnnotationDescription(description: string) {
     if (['http:', 'https:'].includes(new URL(description).protocol))
       return <a href={description} target='_blank' rel='noopener noreferrer'>{description}</a>;
   } catch {}
-  return description;
+  return <span dangerouslySetInnerHTML={{ __html: description }}></span>;
 }
 
 function TestCaseAnnotationView({ annotation: { type, description } }: { annotation: TestCaseAnnotation }) {
   return (
     <div className='test-case-annotation'>
       <span style={{ fontWeight: 'bold' }}>{type}</span>
-      {description && <span>: {renderAnnotationDescription(description)}</span>}
+      {description && <>: {renderAnnotationDescription(description)}</>}
     </div>
   );
 }

here:

function renderAnnotationDescription(description: string) {

Example

No response

Motivation

Make annotation descriptions of complex format human readable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants