1+ import type { TemplateResult } from 'lit' ;
12import { html , nothing } from 'lit' ;
23import { customElement , property } from 'lit/decorators.js' ;
34import type { MutantModel , TestModel } from 'mutation-testing-metrics' ;
@@ -10,6 +11,11 @@ import { renderDetailLine, renderEmoji, renderSummaryContainer, renderSummaryLin
1011
1112const describeTest = ( test : TestModel ) => `${ test . name } ${ test . sourceFile && test . location ? ` (${ describeLocation ( test ) } )` : '' } ` ;
1213
14+ /**
15+ * Wrap so that the whitespace is preserved when rendered
16+ */
17+ const whitespacePreserving = ( content : string | TemplateResult ) => html `< span class ="whitespace-pre-wrap "> ${ content } </ span > ` ;
18+
1319@customElement ( 'mte-drawer-mutant' )
1420export class MutationTestReportDrawerMutant extends RealTimeElement {
1521 @property ( )
@@ -60,9 +66,14 @@ export class MutationTestReportDrawerMutant extends RealTimeElement {
6066 ) }
6167 ${ renderIf (
6268 this . mutant ?. statusReason ?. trim ( ) ,
63- renderSummaryLine ( html `${ renderEmoji ( '🕵️' , 'spy' ) } ${ this . mutant ! . statusReason ! } ` , `Reason for the ${ this . mutant ! . status } status` ) ,
69+ renderSummaryLine (
70+ html `${ renderEmoji ( '🕵️' , 'spy' ) } ${ whitespacePreserving ( this . mutant ! . statusReason ! ) } ` ,
71+ `Reason for the ${ this . mutant ! . status } status` ,
72+ ) ,
6473 ) }
65- ${ renderIfPresent ( this . mutant ?. description , ( description ) => renderSummaryLine ( html `${ renderEmoji ( '📖' , 'book' ) } ${ description } ` ) ) } ` ,
74+ ${ renderIfPresent ( this . mutant ?. description , ( description ) =>
75+ renderSummaryLine ( html `${ renderEmoji ( '📖' , 'book' ) } ${ whitespacePreserving ( description ) } ` ) ,
76+ ) } `,
6677 ) ;
6778 }
6879
0 commit comments