chore: do not double trim in trace viewer (#12338)
This commit is contained in:
parent
91672595f2
commit
821a8e93c7
|
|
@ -68,7 +68,7 @@ export const CallTab: React.FunctionComponent<{
|
||||||
|
|
||||||
function renderLine(metadata: CallMetadata, name: string, value: any, key: string) {
|
function renderLine(metadata: CallMetadata, name: string, value: any, key: string) {
|
||||||
const { title, type } = toString(metadata, name, value);
|
const { title, type } = toString(metadata, name, value);
|
||||||
let text = trimRight(title.replace(/\n/g, '↵'), 80);
|
let text = title.replace(/\n/g, '↵');
|
||||||
if (type === 'string')
|
if (type === 'string')
|
||||||
text = `"${text}"`;
|
text = `"${text}"`;
|
||||||
return <div key={key} className='call-line'>{name}: <span className={type} title={title}>{text}</span></div>;
|
return <div key={key} className='call-line'>{name}: <span className={type} title={title}>{text}</span></div>;
|
||||||
|
|
@ -88,9 +88,3 @@ function toString(metadata: CallMetadata, name: string, value: any): { title: st
|
||||||
return { title: '<handle>', type: 'handle' };
|
return { title: '<handle>', type: 'handle' };
|
||||||
return { title: JSON.stringify(value), type: 'object' };
|
return { title: JSON.stringify(value), type: 'object' };
|
||||||
}
|
}
|
||||||
|
|
||||||
function trimRight(text: string, max: number): string {
|
|
||||||
if (text.length > max)
|
|
||||||
return text.substr(0, max) + '\u2026';
|
|
||||||
return text;
|
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -250,7 +250,7 @@ test('should show params and return value', async ({ showTraceViewer, browserNam
|
||||||
/page.evaluate/,
|
/page.evaluate/,
|
||||||
/wall time: [0-9/:,APM ]+/,
|
/wall time: [0-9/:,APM ]+/,
|
||||||
/duration: [\d]+ms/,
|
/duration: [\d]+ms/,
|
||||||
'expression: "({↵ a↵ }) => {↵ console.log(\'Info\');↵ console.warn(\'Warning\');↵ con…"',
|
/expression: "\({↵ a↵ }\) => {↵ console\.log\(\'Info\'\);↵ console\.warn\(\'Warning\'\);↵ console/,
|
||||||
'isFunction: true',
|
'isFunction: true',
|
||||||
'arg: {"a":"paramA","b":4}',
|
'arg: {"a":"paramA","b":4}',
|
||||||
'value: "return paramA"'
|
'value: "return paramA"'
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue