Refactoring

This commit is contained in:
Aman Kumar 2024-03-28 19:31:53 +05:30
parent a7c45a156b
commit ac45994ca8
3 changed files with 13 additions and 6 deletions

View file

@ -120,7 +120,7 @@ export class Filter {
line: String(test.location.line),
column: String(test.location.column),
labels: test.tags.map(tag => tag.toLowerCase()),
annotations: test.annotations.map(a => a.type.toLowerCase() + ':' + a.description?.toLocaleLowerCase())
annotations: test.annotations.map(a => a.type.toLowerCase() + '=' + a.description?.toLocaleLowerCase())
};
(test as any).searchValues = searchValues;
}

View file

@ -73,4 +73,14 @@
display: flex;
flex-direction: row;
flex-wrap: wrap;
}
#annotation-copy-button{
padding-left: 3px;
display: none;
}
.test-case-annotation:hover #annotation-copy-button{
padding-left: 3px;
display: inline;
}

View file

@ -74,14 +74,11 @@ function renderAnnotationDescription(description: string) {
}
function TestCaseAnnotationView({ annotation: { type, description } }: { annotation: TestCaseAnnotation }) {
const [hover, setHover] = React.useState(false);
const onHover = () => setHover(true);
const onLeave = () => setHover(false);
return (
<div className='test-case-annotation' onMouseEnter={onHover} onMouseLeave={onLeave}>
<div className='test-case-annotation'>
<span style={{ fontWeight: 'bold', display: 'inline-block', marginBlock: '3px' }}>{type}</span>
{description && <span>: {renderAnnotationDescription(description)}</span>}
<span style={{ paddingLeft: '3px' }}>{hover && description && <CopyToClipboard value={description} />}</span>
<span id='annotation-copy-button'>{description && <CopyToClipboard value={description} />}</span>
</div>
);
}