Copy annoation text to clipboard
This commit is contained in:
parent
e7a11c0ca2
commit
de5807ce9d
|
|
@ -74,3 +74,13 @@
|
||||||
flex-direction: row;
|
flex-direction: row;
|
||||||
flex-wrap: wrap;
|
flex-wrap: wrap;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.annotation-copy-button{
|
||||||
|
padding-left: 3px;
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.test-case-annotation:hover .annotation-copy-button{
|
||||||
|
padding-left: 3px;
|
||||||
|
display: inline;
|
||||||
|
}
|
||||||
|
|
@ -25,6 +25,7 @@ import './testCaseView.css';
|
||||||
import { TestResultView } from './testResultView';
|
import { TestResultView } from './testResultView';
|
||||||
import { hashStringToInt } from './labelUtils';
|
import { hashStringToInt } from './labelUtils';
|
||||||
import { msToString } from './uiUtils';
|
import { msToString } from './uiUtils';
|
||||||
|
import { CopyToClipboard } from './copyToClipboard';
|
||||||
|
|
||||||
export const TestCaseView: React.FC<{
|
export const TestCaseView: React.FC<{
|
||||||
projectNames: string[],
|
projectNames: string[],
|
||||||
|
|
@ -68,15 +69,16 @@ function renderAnnotationDescription(description: string) {
|
||||||
try {
|
try {
|
||||||
if (['http:', 'https:'].includes(new URL(description).protocol))
|
if (['http:', 'https:'].includes(new URL(description).protocol))
|
||||||
return <a href={description} target='_blank' rel='noopener noreferrer'>{description}</a>;
|
return <a href={description} target='_blank' rel='noopener noreferrer'>{description}</a>;
|
||||||
} catch {}
|
} catch { }
|
||||||
return description;
|
return description;
|
||||||
}
|
}
|
||||||
|
|
||||||
function TestCaseAnnotationView({ annotation: { type, description } }: { annotation: TestCaseAnnotation }) {
|
function TestCaseAnnotationView({ annotation: { type, description } }: { annotation: TestCaseAnnotation }) {
|
||||||
return (
|
return (
|
||||||
<div className='test-case-annotation'>
|
<div className='test-case-annotation'>
|
||||||
<span style={{ fontWeight: 'bold' }}>{type}</span>
|
<span style={{ fontWeight: 'bold', display: 'inline-block', marginBlock: '3px' }}>{type}</span>
|
||||||
{description && <span>: {renderAnnotationDescription(description)}</span>}
|
{description && <span>: {renderAnnotationDescription(description)}</span>}
|
||||||
|
<span className='annotation-copy-button'>{description && <CopyToClipboard value={description} />}</span>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue