@kylincloud/flamegraph 0.35.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +1211 -0
- package/LICENSE +202 -0
- package/README.md +251 -0
- package/dist/FlameGraph/FlameGraphComponent/CheckIcon.d.ts +2 -0
- package/dist/FlameGraph/FlameGraphComponent/CheckIcon.d.ts.map +1 -0
- package/dist/FlameGraph/FlameGraphComponent/ContextMenu.d.ts +17 -0
- package/dist/FlameGraph/FlameGraphComponent/ContextMenu.d.ts.map +1 -0
- package/dist/FlameGraph/FlameGraphComponent/ContextMenuHighlight.d.ts +14 -0
- package/dist/FlameGraph/FlameGraphComponent/ContextMenuHighlight.d.ts.map +1 -0
- package/dist/FlameGraph/FlameGraphComponent/DiffLegend.d.ts +9 -0
- package/dist/FlameGraph/FlameGraphComponent/DiffLegend.d.ts.map +1 -0
- package/dist/FlameGraph/FlameGraphComponent/DiffLegendPaletteDropdown.d.ts +8 -0
- package/dist/FlameGraph/FlameGraphComponent/DiffLegendPaletteDropdown.d.ts.map +1 -0
- package/dist/FlameGraph/FlameGraphComponent/Flamegraph.d.ts +96 -0
- package/dist/FlameGraph/FlameGraphComponent/Flamegraph.d.ts.map +1 -0
- package/dist/FlameGraph/FlameGraphComponent/Flamegraph_render.d.ts +27 -0
- package/dist/FlameGraph/FlameGraphComponent/Flamegraph_render.d.ts.map +1 -0
- package/dist/FlameGraph/FlameGraphComponent/GraphVizPane.d.ts +7 -0
- package/dist/FlameGraph/FlameGraphComponent/GraphVizPane.d.ts.map +1 -0
- package/dist/FlameGraph/FlameGraphComponent/Header.d.ts +12 -0
- package/dist/FlameGraph/FlameGraphComponent/Header.d.ts.map +1 -0
- package/dist/FlameGraph/FlameGraphComponent/Highlight.d.ts +18 -0
- package/dist/FlameGraph/FlameGraphComponent/Highlight.d.ts.map +1 -0
- package/dist/FlameGraph/FlameGraphComponent/LogoLink.d.ts +2 -0
- package/dist/FlameGraph/FlameGraphComponent/LogoLink.d.ts.map +1 -0
- package/dist/FlameGraph/FlameGraphComponent/color.d.ts +20 -0
- package/dist/FlameGraph/FlameGraphComponent/color.d.ts.map +1 -0
- package/dist/FlameGraph/FlameGraphComponent/colorPalette.d.ts +11 -0
- package/dist/FlameGraph/FlameGraphComponent/colorPalette.d.ts.map +1 -0
- package/dist/FlameGraph/FlameGraphComponent/constants.d.ts +6 -0
- package/dist/FlameGraph/FlameGraphComponent/constants.d.ts.map +1 -0
- package/dist/FlameGraph/FlameGraphComponent/index.d.ts +37 -0
- package/dist/FlameGraph/FlameGraphComponent/index.d.ts.map +1 -0
- package/dist/FlameGraph/FlameGraphComponent/murmur3.d.ts +2 -0
- package/dist/FlameGraph/FlameGraphComponent/murmur3.d.ts.map +1 -0
- package/dist/FlameGraph/FlameGraphComponent/testData.d.ts +53 -0
- package/dist/FlameGraph/FlameGraphComponent/testData.d.ts.map +1 -0
- package/dist/FlameGraph/FlameGraphComponent/utils.d.ts +6 -0
- package/dist/FlameGraph/FlameGraphComponent/utils.d.ts.map +1 -0
- package/dist/FlameGraph/FlameGraphComponent/viewTypes.d.ts +2 -0
- package/dist/FlameGraph/FlameGraphComponent/viewTypes.d.ts.map +1 -0
- package/dist/FlameGraph/FlameGraphRenderer.d.ts +86 -0
- package/dist/FlameGraph/FlameGraphRenderer.d.ts.map +1 -0
- package/dist/FlameGraph/decode.d.ts +27 -0
- package/dist/FlameGraph/decode.d.ts.map +1 -0
- package/dist/FlameGraph/normalize.d.ts +6 -0
- package/dist/FlameGraph/normalize.d.ts.map +1 -0
- package/dist/FlameGraph/uniqueness.d.ts +3 -0
- package/dist/FlameGraph/uniqueness.d.ts.map +1 -0
- package/dist/FlamegraphRenderer.d.ts +19 -0
- package/dist/FlamegraphRenderer.d.ts.map +1 -0
- package/dist/Icons.d.ts +9 -0
- package/dist/Icons.d.ts.map +1 -0
- package/dist/ProfilerTable.d.ts +21 -0
- package/dist/ProfilerTable.d.ts.map +1 -0
- package/dist/SharedQueryInput.d.ts +10 -0
- package/dist/SharedQueryInput.d.ts.map +1 -0
- package/dist/Toolbar.d.ts +31 -0
- package/dist/Toolbar.d.ts.map +1 -0
- package/dist/Tooltip/FlamegraphTooltip.d.ts +59 -0
- package/dist/Tooltip/FlamegraphTooltip.d.ts.map +1 -0
- package/dist/Tooltip/LeftClickIcon.d.ts +2 -0
- package/dist/Tooltip/LeftClickIcon.d.ts.map +1 -0
- package/dist/Tooltip/RightClickIcon.d.ts +2 -0
- package/dist/Tooltip/RightClickIcon.d.ts.map +1 -0
- package/dist/Tooltip/TableTooltip.d.ts +12 -0
- package/dist/Tooltip/TableTooltip.d.ts.map +1 -0
- package/dist/Tooltip/Tooltip.d.ts +29 -0
- package/dist/Tooltip/Tooltip.d.ts.map +1 -0
- package/dist/convert/convertJaegerTraceToProfile.d.ts +3 -0
- package/dist/convert/convertJaegerTraceToProfile.d.ts.map +1 -0
- package/dist/convert/diffTwoProfiles.d.ts +3 -0
- package/dist/convert/diffTwoProfiles.d.ts.map +1 -0
- package/dist/convert/flamebearersToTree.d.ts +11 -0
- package/dist/convert/flamebearersToTree.d.ts.map +1 -0
- package/dist/convert/sandwichViewProfiles.d.ts +14 -0
- package/dist/convert/sandwichViewProfiles.d.ts.map +1 -0
- package/dist/convert/subtract.d.ts +3 -0
- package/dist/convert/subtract.d.ts.map +1 -0
- package/dist/convert/testData.d.ts +50 -0
- package/dist/convert/testData.d.ts.map +1 -0
- package/dist/convert/toGraphviz.d.ts +3 -0
- package/dist/convert/toGraphviz.d.ts.map +1 -0
- package/dist/fitMode/fitMode.d.ts +42 -0
- package/dist/fitMode/fitMode.d.ts.map +1 -0
- package/dist/format/format.d.ts +42 -0
- package/dist/format/format.d.ts.map +1 -0
- package/dist/i18n.d.ts +55 -0
- package/dist/i18n.d.ts.map +1 -0
- package/dist/index.cjs.css +792 -0
- package/dist/index.cjs.js +5087 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.esm.css +792 -0
- package/dist/index.esm.js +5079 -0
- package/dist/index.node.d.ts +9 -0
- package/dist/index.node.d.ts.map +1 -0
- package/dist/logo-v3-small-T5VXIMRR.svg +32 -0
- package/dist/models/decode.d.ts +3 -0
- package/dist/models/decode.d.ts.map +1 -0
- package/dist/models/flamebearer.d.ts +63 -0
- package/dist/models/flamebearer.d.ts.map +1 -0
- package/dist/models/groups.d.ts +37 -0
- package/dist/models/groups.d.ts.map +1 -0
- package/dist/models/index.d.ts +8 -0
- package/dist/models/index.d.ts.map +1 -0
- package/dist/models/profile.d.ts +152 -0
- package/dist/models/profile.d.ts.map +1 -0
- package/dist/models/spyName.d.ts +8 -0
- package/dist/models/spyName.d.ts.map +1 -0
- package/dist/models/trace.d.ts +357 -0
- package/dist/models/trace.d.ts.map +1 -0
- package/dist/models/units.d.ts +6 -0
- package/dist/models/units.d.ts.map +1 -0
- package/dist/search.d.ts +2 -0
- package/dist/search.d.ts.map +1 -0
- package/dist/shims/Box.d.ts +38 -0
- package/dist/shims/Box.d.ts.map +1 -0
- package/dist/shims/Button.d.ts +26 -0
- package/dist/shims/Button.d.ts.map +1 -0
- package/dist/shims/Dropdown.d.ts +30 -0
- package/dist/shims/Dropdown.d.ts.map +1 -0
- package/dist/shims/Input.d.ts +19 -0
- package/dist/shims/Input.d.ts.map +1 -0
- package/dist/shims/LoadingSpinner.d.ts +7 -0
- package/dist/shims/LoadingSpinner.d.ts.map +1 -0
- package/dist/shims/Menu.d.ts +4 -0
- package/dist/shims/Menu.d.ts.map +1 -0
- package/dist/shims/NoData.d.ts +2 -0
- package/dist/shims/NoData.d.ts.map +1 -0
- package/dist/shims/Table.d.ts +52 -0
- package/dist/shims/Table.d.ts.map +1 -0
- package/dist/shims/Tooltip.d.ts +9 -0
- package/dist/shims/Tooltip.d.ts.map +1 -0
- package/package.json +84 -0
- package/src/FlameGraph/FlameGraphComponent/CheckIcon.tsx +27 -0
- package/src/FlameGraph/FlameGraphComponent/ContextMenu.module.scss +10 -0
- package/src/FlameGraph/FlameGraphComponent/ContextMenu.spec.tsx +84 -0
- package/src/FlameGraph/FlameGraphComponent/ContextMenu.tsx +86 -0
- package/src/FlameGraph/FlameGraphComponent/ContextMenuHighlight.module.css +8 -0
- package/src/FlameGraph/FlameGraphComponent/ContextMenuHighlight.tsx +47 -0
- package/src/FlameGraph/FlameGraphComponent/DiffLegend.module.css +21 -0
- package/src/FlameGraph/FlameGraphComponent/DiffLegend.tsx +52 -0
- package/src/FlameGraph/FlameGraphComponent/DiffLegendPaletteDropdown.module.css +40 -0
- package/src/FlameGraph/FlameGraphComponent/DiffLegendPaletteDropdown.tsx +129 -0
- package/src/FlameGraph/FlameGraphComponent/Flamegraph.spec.ts +552 -0
- package/src/FlameGraph/FlameGraphComponent/Flamegraph.ts +446 -0
- package/src/FlameGraph/FlameGraphComponent/Flamegraph_render.spec.tsx +233 -0
- package/src/FlameGraph/FlameGraphComponent/Flamegraph_render.ts +478 -0
- package/src/FlameGraph/FlameGraphComponent/GraphVizPane.tsx +56 -0
- package/src/FlameGraph/FlameGraphComponent/GraphVizPanel.module.scss +55 -0
- package/src/FlameGraph/FlameGraphComponent/Header.module.css +27 -0
- package/src/FlameGraph/FlameGraphComponent/Header.tsx +71 -0
- package/src/FlameGraph/FlameGraphComponent/Highlight.module.css +7 -0
- package/src/FlameGraph/FlameGraphComponent/Highlight.spec.tsx +53 -0
- package/src/FlameGraph/FlameGraphComponent/Highlight.tsx +94 -0
- package/src/FlameGraph/FlameGraphComponent/LogoLink.module.scss +10 -0
- package/src/FlameGraph/FlameGraphComponent/LogoLink.tsx +101 -0
- package/src/FlameGraph/FlameGraphComponent/__image_snapshots__/canvas-renderer-spec-tsx-canvas-renderer-group-snapshot-collapses-small-blocks-into-one-1-snap.png +0 -0
- package/src/FlameGraph/FlameGraphComponent/__image_snapshots__/canvas-renderer-spec-tsx-canvas-renderer-group-snapshot-works-with-diff-mode-1-snap.png +0 -0
- package/src/FlameGraph/FlameGraphComponent/__image_snapshots__/canvas-renderer-spec-tsx-canvas-renderer-group-snapshot-works-with-highlighted-flamegraph-1-snap.png +0 -0
- package/src/FlameGraph/FlameGraphComponent/__image_snapshots__/canvas-renderer-spec-tsx-canvas-renderer-group-snapshot-works-with-normal-flamegraph-1-snap.png +0 -0
- package/src/FlameGraph/FlameGraphComponent/__image_snapshots__/canvas-renderer-spec-tsx-canvas-renderer-group-snapshot-works-with-selected-node-1-snap.png +0 -0
- package/src/FlameGraph/FlameGraphComponent/__image_snapshots__/flamegraph-render-spec-tsx-render-group-snapshot-focused-also-zooms-1-snap.png +0 -0
- package/src/FlameGraph/FlameGraphComponent/__image_snapshots__/flamegraph-render-spec-tsx-render-group-snapshot-focused-renders-a-focused-node-in-the-beginning-1-snap.png +0 -0
- package/src/FlameGraph/FlameGraphComponent/__image_snapshots__/flamegraph-render-spec-tsx-render-group-snapshot-focused-renders-a-focused-node-when-node-is-not-in-the-beginning-1-snap.png +0 -0
- package/src/FlameGraph/FlameGraphComponent/__image_snapshots__/flamegraph-render-spec-tsx-render-group-snapshot-focused-renders-a-focused-node-zoom-top-level-1-snap.png +0 -0
- package/src/FlameGraph/FlameGraphComponent/__image_snapshots__/flamegraph-render-spec-tsx-render-group-snapshot-renders-a-complex-flamegraph-1-snap.png +0 -0
- package/src/FlameGraph/FlameGraphComponent/__image_snapshots__/flamegraph-render-spec-tsx-render-group-snapshot-renders-a-double-diff-flamegraph-1-snap.png +0 -0
- package/src/FlameGraph/FlameGraphComponent/__image_snapshots__/flamegraph-render-spec-tsx-render-group-snapshot-renders-a-highlighted-double-flamegraph-1-snap.png +0 -0
- package/src/FlameGraph/FlameGraphComponent/__image_snapshots__/flamegraph-render-spec-tsx-render-group-snapshot-renders-a-highlighted-flamegraph-1-snap.png +0 -0
- package/src/FlameGraph/FlameGraphComponent/__image_snapshots__/flamegraph-render-spec-tsx-render-group-snapshot-renders-a-simple-flamegraph-1-snap.png +0 -0
- package/src/FlameGraph/FlameGraphComponent/__image_snapshots__/flamegraph-render-spec-tsx-render-group-snapshot-renders-a-simple-tree-1-snap.png +0 -0
- package/src/FlameGraph/FlameGraphComponent/__image_snapshots__/flamegraph-render-spec-tsx-render-group-snapshot-renders-a-zoomed-flamegraph-1-snap.png +0 -0
- package/src/FlameGraph/FlameGraphComponent/__image_snapshots__/flamegraph-render-spec-tsx-render-group-snapshot-renders-a-zoomed-with-fit-mode-tail-1-snap.png +0 -0
- package/src/FlameGraph/FlameGraphComponent/canvas.module.css +6 -0
- package/src/FlameGraph/FlameGraphComponent/color.spec.ts +308 -0
- package/src/FlameGraph/FlameGraphComponent/color.ts +167 -0
- package/src/FlameGraph/FlameGraphComponent/colorPalette.ts +58 -0
- package/src/FlameGraph/FlameGraphComponent/constants.ts +5 -0
- package/src/FlameGraph/FlameGraphComponent/index.spec.tsx +291 -0
- package/src/FlameGraph/FlameGraphComponent/index.tsx +411 -0
- package/src/FlameGraph/FlameGraphComponent/murmur3.ts +97 -0
- package/src/FlameGraph/FlameGraphComponent/styles.module.scss +10 -0
- package/src/FlameGraph/FlameGraphComponent/testData.ts +427 -0
- package/src/FlameGraph/FlameGraphComponent/utils.ts +31 -0
- package/src/FlameGraph/FlameGraphComponent/viewTypes.ts +6 -0
- package/src/FlameGraph/FlameGraphRenderer.tsx +603 -0
- package/src/FlameGraph/FlamegraphRenderer.module.scss +93 -0
- package/src/FlameGraph/decode.ts +78 -0
- package/src/FlameGraph/normalize.spec.ts +76 -0
- package/src/FlameGraph/normalize.ts +60 -0
- package/src/FlameGraph/testData.json +423 -0
- package/src/FlameGraph/uniqueness.spec.ts +16 -0
- package/src/FlameGraph/uniqueness.ts +84 -0
- package/src/FlamegraphRenderer.tsx +61 -0
- package/src/Icons.tsx +74 -0
- package/src/ProfilerTable.tsx +527 -0
- package/src/SharedQueryInput.module.scss +82 -0
- package/src/SharedQueryInput.tsx +127 -0
- package/src/Toolbar.module.scss +117 -0
- package/src/Toolbar.spec.tsx +217 -0
- package/src/Toolbar.tsx +471 -0
- package/src/Tooltip/FlamegraphTooltip.spec.tsx +81 -0
- package/src/Tooltip/FlamegraphTooltip.tsx +257 -0
- package/src/Tooltip/LeftClickIcon.tsx +18 -0
- package/src/Tooltip/RightClickIcon.tsx +18 -0
- package/src/Tooltip/TableTooltip.spec.tsx +44 -0
- package/src/Tooltip/TableTooltip.tsx +145 -0
- package/src/Tooltip/Tooltip.module.scss +71 -0
- package/src/Tooltip/Tooltip.spec.tsx +395 -0
- package/src/Tooltip/Tooltip.tsx +336 -0
- package/src/__snapshots__/Toolbar.spec.tsx.snap +297 -0
- package/src/convert/convertJaegerTraceToProfile.ts +97 -0
- package/src/convert/diffTwoProfiles.ts +81 -0
- package/src/convert/flamebearersToTree.ts +78 -0
- package/src/convert/sandwichViewProfiles.spec.ts +65 -0
- package/src/convert/sandwichViewProfiles.ts +191 -0
- package/src/convert/subtract.ts +87 -0
- package/src/convert/testData.ts +145 -0
- package/src/convert/toGraphviz.ts +485 -0
- package/src/fitMode/fitMode.spec.ts +93 -0
- package/src/fitMode/fitMode.ts +122 -0
- package/src/format/format.spec.ts +291 -0
- package/src/format/format.ts +303 -0
- package/src/globals.d.ts +13 -0
- package/src/i18n.tsx +293 -0
- package/src/index.node.ts +19 -0
- package/src/index.spec.tsx +383 -0
- package/src/index.tsx +10 -0
- package/src/logo-v3-small.svg +32 -0
- package/src/models/decode.ts +45 -0
- package/src/models/flamebearer.ts +86 -0
- package/src/models/groups.ts +14 -0
- package/src/models/index.ts +7 -0
- package/src/models/profile.spec.ts +32 -0
- package/src/models/profile.ts +48 -0
- package/src/models/spyName.spec.ts +18 -0
- package/src/models/spyName.ts +32 -0
- package/src/models/trace.ts +45 -0
- package/src/models/units.spec.ts +21 -0
- package/src/models/units.ts +24 -0
- package/src/sass/_common.scss +206 -0
- package/src/sass/_css-variables.scss +201 -0
- package/src/sass/_mixins.scss +15 -0
- package/src/sass/_sanitize.scss +407 -0
- package/src/sass/_variables.scss +53 -0
- package/src/sass/flamegraph.scss +18 -0
- package/src/search.spec.ts +11 -0
- package/src/search.ts +4 -0
- package/src/shameful-any.d.ts +2 -0
- package/src/shims/Box.module.scss +57 -0
- package/src/shims/Box.tsx +105 -0
- package/src/shims/Button.module.scss +129 -0
- package/src/shims/Button.tsx +128 -0
- package/src/shims/Dropdown.module.scss +63 -0
- package/src/shims/Dropdown.tsx +96 -0
- package/src/shims/Input.module.scss +15 -0
- package/src/shims/Input.tsx +55 -0
- package/src/shims/LoadingSpinner.tsx +19 -0
- package/src/shims/Menu.tsx +9 -0
- package/src/shims/NoData.module.scss +6 -0
- package/src/shims/NoData.tsx +11 -0
- package/src/shims/Table.module.scss +82 -0
- package/src/shims/Table.spec.tsx +121 -0
- package/src/shims/Table.tsx +252 -0
- package/src/shims/Tooltip.tsx +51 -0
|
@@ -0,0 +1,395 @@
|
|
|
1
|
+
/* eslint-disable react/jsx-props-no-spreading */
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { render, screen } from '@testing-library/react';
|
|
4
|
+
import userEvent from '@testing-library/user-event';
|
|
5
|
+
|
|
6
|
+
import { Tooltip, TooltipProps } from './Tooltip';
|
|
7
|
+
|
|
8
|
+
function TestCanvas(props: Omit<TooltipProps, 'dataSourceRef'>) {
|
|
9
|
+
const canvasRef = React.useRef<HTMLCanvasElement>(null);
|
|
10
|
+
|
|
11
|
+
return (
|
|
12
|
+
<>
|
|
13
|
+
<canvas data-testid="canvas" ref={canvasRef} />
|
|
14
|
+
<Tooltip
|
|
15
|
+
data-testid="tooltip"
|
|
16
|
+
{...(props as TooltipProps)}
|
|
17
|
+
dataSourceRef={canvasRef}
|
|
18
|
+
/>
|
|
19
|
+
</>
|
|
20
|
+
);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
function TestTable(props: Omit<TooltipProps, 'dataSourceRef'>) {
|
|
24
|
+
const tableBodyRef = React.useRef<HTMLTableSectionElement>(null);
|
|
25
|
+
|
|
26
|
+
return (
|
|
27
|
+
<>
|
|
28
|
+
<table>
|
|
29
|
+
<tbody data-testid="table-body" ref={tableBodyRef}>
|
|
30
|
+
<tr>
|
|
31
|
+
<td>text</td>
|
|
32
|
+
</tr>
|
|
33
|
+
</tbody>
|
|
34
|
+
</table>
|
|
35
|
+
<Tooltip
|
|
36
|
+
data-testid="tooltip"
|
|
37
|
+
{...(props as TooltipProps)}
|
|
38
|
+
dataSourceRef={tableBodyRef}
|
|
39
|
+
/>
|
|
40
|
+
</>
|
|
41
|
+
);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
describe('Tooltip', () => {
|
|
45
|
+
describe('flamegraph tooltip', () => {
|
|
46
|
+
it("'single' mode with default settings renders correctly", () => {
|
|
47
|
+
render(
|
|
48
|
+
<TestCanvas
|
|
49
|
+
clickInfoSide="right"
|
|
50
|
+
setTooltipContent={(setContent) => {
|
|
51
|
+
setContent({
|
|
52
|
+
title: {
|
|
53
|
+
text: 'function_title',
|
|
54
|
+
diff: {
|
|
55
|
+
text: '',
|
|
56
|
+
color: '',
|
|
57
|
+
},
|
|
58
|
+
},
|
|
59
|
+
tooltipData: [
|
|
60
|
+
{
|
|
61
|
+
units: 'samples',
|
|
62
|
+
percent: 100,
|
|
63
|
+
samples: '100',
|
|
64
|
+
formattedValue: '1 second',
|
|
65
|
+
tooltipType: 'flamegraph',
|
|
66
|
+
},
|
|
67
|
+
],
|
|
68
|
+
});
|
|
69
|
+
}}
|
|
70
|
+
/>
|
|
71
|
+
);
|
|
72
|
+
|
|
73
|
+
expect(screen.getByTestId('tooltip')).toBeInTheDocument();
|
|
74
|
+
|
|
75
|
+
userEvent.hover(screen.getByTestId('canvas'));
|
|
76
|
+
|
|
77
|
+
expect(screen.getByTestId('tooltip-title')).toHaveTextContent(
|
|
78
|
+
'function_title'
|
|
79
|
+
);
|
|
80
|
+
expect(screen.getByTestId('tooltip-function-name')).toHaveTextContent(
|
|
81
|
+
'function_title'
|
|
82
|
+
);
|
|
83
|
+
expect(screen.getByTestId('tooltip-table')).toHaveTextContent(
|
|
84
|
+
'Share of CPU:100CPU Time:1 secondSamples:100'
|
|
85
|
+
);
|
|
86
|
+
expect(screen.getByTestId('tooltip-footer')).toHaveTextContent(
|
|
87
|
+
'Right click for more node viewing options'
|
|
88
|
+
);
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
describe("'double' mode with default settings", () => {
|
|
92
|
+
it("works with a function that hasn't changed", () => {
|
|
93
|
+
render(
|
|
94
|
+
<TestCanvas
|
|
95
|
+
clickInfoSide="right"
|
|
96
|
+
setTooltipContent={(setContent) => {
|
|
97
|
+
setContent({
|
|
98
|
+
title: {
|
|
99
|
+
text: 'function_title',
|
|
100
|
+
diff: {
|
|
101
|
+
text: '(+99900.00%)',
|
|
102
|
+
color: 'rgb(200, 0, 0)',
|
|
103
|
+
},
|
|
104
|
+
},
|
|
105
|
+
tooltipData: [
|
|
106
|
+
{
|
|
107
|
+
percent: '0.1%',
|
|
108
|
+
samples: '100',
|
|
109
|
+
units: 'samples',
|
|
110
|
+
formattedValue: '1.00 second',
|
|
111
|
+
tooltipType: 'flamegraph',
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
percent: '100%',
|
|
115
|
+
samples: '100',
|
|
116
|
+
units: 'samples',
|
|
117
|
+
formattedValue: '1.00 second',
|
|
118
|
+
tooltipType: 'flamegraph',
|
|
119
|
+
},
|
|
120
|
+
],
|
|
121
|
+
});
|
|
122
|
+
}}
|
|
123
|
+
/>
|
|
124
|
+
);
|
|
125
|
+
|
|
126
|
+
expect(screen.getByTestId('tooltip')).toBeInTheDocument();
|
|
127
|
+
|
|
128
|
+
userEvent.hover(screen.getByTestId('canvas'));
|
|
129
|
+
|
|
130
|
+
expect(screen.getByTestId('tooltip-title')).toHaveTextContent(
|
|
131
|
+
'function_title'
|
|
132
|
+
);
|
|
133
|
+
expect(screen.getByTestId('tooltip-function-name')).toHaveTextContent(
|
|
134
|
+
'function_title'
|
|
135
|
+
);
|
|
136
|
+
expect(screen.getByTestId('tooltip-table')).toHaveTextContent(
|
|
137
|
+
'BaselineComparisonDiffShare of CPU:0.1%100%(+99900.00%)CPU Time:1.00 second1.00 secondSamples:100100'
|
|
138
|
+
);
|
|
139
|
+
expect(screen.getByTestId('tooltip-footer')).toHaveTextContent(
|
|
140
|
+
'Right click for more node viewing options'
|
|
141
|
+
);
|
|
142
|
+
});
|
|
143
|
+
|
|
144
|
+
it('works with a function that has been added', () => {
|
|
145
|
+
render(
|
|
146
|
+
<TestCanvas
|
|
147
|
+
clickInfoSide="right"
|
|
148
|
+
setTooltipContent={(setContent) => {
|
|
149
|
+
setContent({
|
|
150
|
+
title: {
|
|
151
|
+
text: 'function_title',
|
|
152
|
+
diff: {
|
|
153
|
+
text: '(new)',
|
|
154
|
+
color: 'rgb(200, 0, 0)',
|
|
155
|
+
},
|
|
156
|
+
},
|
|
157
|
+
tooltipData: [
|
|
158
|
+
{
|
|
159
|
+
percent: '0%',
|
|
160
|
+
samples: '0',
|
|
161
|
+
units: 'samples',
|
|
162
|
+
formattedValue: '< 0.01 seconds',
|
|
163
|
+
tooltipType: 'flamegraph',
|
|
164
|
+
},
|
|
165
|
+
{
|
|
166
|
+
percent: '10%',
|
|
167
|
+
samples: '100',
|
|
168
|
+
units: 'samples',
|
|
169
|
+
formattedValue: '1.00 second',
|
|
170
|
+
tooltipType: 'flamegraph',
|
|
171
|
+
},
|
|
172
|
+
],
|
|
173
|
+
});
|
|
174
|
+
}}
|
|
175
|
+
/>
|
|
176
|
+
);
|
|
177
|
+
|
|
178
|
+
expect(screen.getByTestId('tooltip')).toBeInTheDocument();
|
|
179
|
+
|
|
180
|
+
userEvent.hover(screen.getByTestId('canvas'));
|
|
181
|
+
|
|
182
|
+
expect(screen.getByTestId('tooltip-title')).toHaveTextContent(
|
|
183
|
+
'function_title'
|
|
184
|
+
);
|
|
185
|
+
expect(screen.getByTestId('tooltip-function-name')).toHaveTextContent(
|
|
186
|
+
'function_title'
|
|
187
|
+
);
|
|
188
|
+
expect(screen.getByTestId('tooltip-table')).toHaveTextContent(
|
|
189
|
+
'BaselineComparisonDiffShare of CPU:0%10%(new)CPU Time:< 0.01 seconds1.00 secondSamples:0100'
|
|
190
|
+
);
|
|
191
|
+
expect(screen.getByTestId('tooltip-footer')).toHaveTextContent(
|
|
192
|
+
'Right click for more node viewing options'
|
|
193
|
+
);
|
|
194
|
+
});
|
|
195
|
+
|
|
196
|
+
it('works with a function that has been removed', () => {
|
|
197
|
+
render(
|
|
198
|
+
<TestCanvas
|
|
199
|
+
clickInfoSide="right"
|
|
200
|
+
setTooltipContent={(setContent) => {
|
|
201
|
+
setContent({
|
|
202
|
+
title: {
|
|
203
|
+
text: 'function_title',
|
|
204
|
+
diff: {
|
|
205
|
+
text: '(removed)',
|
|
206
|
+
color: 'rgb(0, 170, 0)',
|
|
207
|
+
},
|
|
208
|
+
},
|
|
209
|
+
tooltipData: [
|
|
210
|
+
{
|
|
211
|
+
percent: '10%',
|
|
212
|
+
samples: '100',
|
|
213
|
+
units: 'samples',
|
|
214
|
+
formattedValue: '1.00 second',
|
|
215
|
+
tooltipType: 'flamegraph',
|
|
216
|
+
},
|
|
217
|
+
{
|
|
218
|
+
percent: '0%',
|
|
219
|
+
samples: '0',
|
|
220
|
+
units: 'samples',
|
|
221
|
+
formattedValue: '< 0.01 seconds',
|
|
222
|
+
tooltipType: 'flamegraph',
|
|
223
|
+
},
|
|
224
|
+
],
|
|
225
|
+
});
|
|
226
|
+
}}
|
|
227
|
+
/>
|
|
228
|
+
);
|
|
229
|
+
|
|
230
|
+
expect(screen.getByTestId('tooltip')).toBeInTheDocument();
|
|
231
|
+
|
|
232
|
+
userEvent.hover(screen.getByTestId('canvas'));
|
|
233
|
+
|
|
234
|
+
expect(screen.getByTestId('tooltip-title')).toHaveTextContent(
|
|
235
|
+
'function_title'
|
|
236
|
+
);
|
|
237
|
+
expect(screen.getByTestId('tooltip-function-name')).toHaveTextContent(
|
|
238
|
+
'function_title'
|
|
239
|
+
);
|
|
240
|
+
expect(screen.getByTestId('tooltip-table')).toHaveTextContent(
|
|
241
|
+
'BaselineComparisonDiffShare of CPU:10%0%(removed)CPU Time:1.00 second< 0.01 secondsSamples:1000'
|
|
242
|
+
);
|
|
243
|
+
expect(screen.getByTestId('tooltip-footer')).toHaveTextContent(
|
|
244
|
+
'Right click for more node viewing options'
|
|
245
|
+
);
|
|
246
|
+
});
|
|
247
|
+
|
|
248
|
+
it('works with a function that became slower', () => {
|
|
249
|
+
render(
|
|
250
|
+
<TestCanvas
|
|
251
|
+
clickInfoSide="right"
|
|
252
|
+
setTooltipContent={(setContent) => {
|
|
253
|
+
setContent({
|
|
254
|
+
title: {
|
|
255
|
+
text: 'function_title',
|
|
256
|
+
diff: {
|
|
257
|
+
text: '(+100.00%)',
|
|
258
|
+
color: 'rgb(200, 0, 0)',
|
|
259
|
+
},
|
|
260
|
+
},
|
|
261
|
+
tooltipData: [
|
|
262
|
+
{
|
|
263
|
+
percent: '10%',
|
|
264
|
+
samples: '100',
|
|
265
|
+
units: 'samples',
|
|
266
|
+
formattedValue: '1.00 second',
|
|
267
|
+
tooltipType: 'flamegraph',
|
|
268
|
+
},
|
|
269
|
+
{
|
|
270
|
+
percent: '20%',
|
|
271
|
+
samples: '200',
|
|
272
|
+
units: 'samples',
|
|
273
|
+
formattedValue: '2.00 seconds',
|
|
274
|
+
tooltipType: 'flamegraph',
|
|
275
|
+
},
|
|
276
|
+
],
|
|
277
|
+
});
|
|
278
|
+
}}
|
|
279
|
+
/>
|
|
280
|
+
);
|
|
281
|
+
|
|
282
|
+
expect(screen.getByTestId('tooltip')).toBeInTheDocument();
|
|
283
|
+
|
|
284
|
+
userEvent.hover(screen.getByTestId('canvas'));
|
|
285
|
+
|
|
286
|
+
expect(screen.getByTestId('tooltip-title')).toHaveTextContent(
|
|
287
|
+
'function_title'
|
|
288
|
+
);
|
|
289
|
+
expect(screen.getByTestId('tooltip-function-name')).toHaveTextContent(
|
|
290
|
+
'function_title'
|
|
291
|
+
);
|
|
292
|
+
expect(screen.getByTestId('tooltip-table')).toHaveTextContent(
|
|
293
|
+
'BaselineComparisonDiffShare of CPU:10%20%(+100.00%)CPU Time:1.00 second2.00 secondsSamples:100200'
|
|
294
|
+
);
|
|
295
|
+
expect(screen.getByTestId('tooltip-footer')).toHaveTextContent(
|
|
296
|
+
'Right click for more node viewing options'
|
|
297
|
+
);
|
|
298
|
+
});
|
|
299
|
+
|
|
300
|
+
it('works with a function that became faster', () => {
|
|
301
|
+
render(
|
|
302
|
+
<TestCanvas
|
|
303
|
+
clickInfoSide="right"
|
|
304
|
+
setTooltipContent={(setContent) => {
|
|
305
|
+
setContent({
|
|
306
|
+
title: {
|
|
307
|
+
text: 'function_title',
|
|
308
|
+
diff: {
|
|
309
|
+
text: '(-50.00%)',
|
|
310
|
+
color: 'rgb(0, 170, 0)',
|
|
311
|
+
},
|
|
312
|
+
},
|
|
313
|
+
tooltipData: [
|
|
314
|
+
{
|
|
315
|
+
percent: '20%',
|
|
316
|
+
samples: '200',
|
|
317
|
+
units: 'samples',
|
|
318
|
+
formattedValue: '2.00 second',
|
|
319
|
+
tooltipType: 'flamegraph',
|
|
320
|
+
},
|
|
321
|
+
{
|
|
322
|
+
percent: '10%',
|
|
323
|
+
samples: '100',
|
|
324
|
+
units: 'samples',
|
|
325
|
+
formattedValue: '1.00 seconds',
|
|
326
|
+
tooltipType: 'flamegraph',
|
|
327
|
+
},
|
|
328
|
+
],
|
|
329
|
+
});
|
|
330
|
+
}}
|
|
331
|
+
/>
|
|
332
|
+
);
|
|
333
|
+
|
|
334
|
+
expect(screen.getByTestId('tooltip')).toBeInTheDocument();
|
|
335
|
+
|
|
336
|
+
userEvent.hover(screen.getByTestId('canvas'));
|
|
337
|
+
|
|
338
|
+
expect(screen.getByTestId('tooltip-title')).toHaveTextContent(
|
|
339
|
+
'function_title'
|
|
340
|
+
);
|
|
341
|
+
expect(screen.getByTestId('tooltip-function-name')).toHaveTextContent(
|
|
342
|
+
'function_title'
|
|
343
|
+
);
|
|
344
|
+
expect(screen.getByTestId('tooltip-table')).toHaveTextContent(
|
|
345
|
+
'BaselineComparisonDiffShare of CPU:20%10%(-50.00%)CPU Time:2.00 second1.00 secondsSamples:200100'
|
|
346
|
+
);
|
|
347
|
+
expect(screen.getByTestId('tooltip-footer')).toHaveTextContent(
|
|
348
|
+
'Right click for more node viewing options'
|
|
349
|
+
);
|
|
350
|
+
});
|
|
351
|
+
});
|
|
352
|
+
});
|
|
353
|
+
|
|
354
|
+
describe('table tooltip', () => {
|
|
355
|
+
it("'single' mode with custom settings renders correctly", () => {
|
|
356
|
+
render(
|
|
357
|
+
<TestTable
|
|
358
|
+
clickInfoSide="left"
|
|
359
|
+
shouldShowFooter={false}
|
|
360
|
+
shouldShowTitle={false}
|
|
361
|
+
setTooltipContent={(setContent) => {
|
|
362
|
+
setContent({
|
|
363
|
+
title: {
|
|
364
|
+
text: 'function_title',
|
|
365
|
+
diff: {
|
|
366
|
+
text: '',
|
|
367
|
+
color: '',
|
|
368
|
+
},
|
|
369
|
+
},
|
|
370
|
+
tooltipData: [
|
|
371
|
+
{
|
|
372
|
+
total: '2 seconds (100%)',
|
|
373
|
+
self: '1 second (50%)',
|
|
374
|
+
tooltipType: 'table',
|
|
375
|
+
units: 'samples',
|
|
376
|
+
},
|
|
377
|
+
],
|
|
378
|
+
});
|
|
379
|
+
}}
|
|
380
|
+
/>
|
|
381
|
+
);
|
|
382
|
+
|
|
383
|
+
expect(screen.getByTestId('tooltip')).toBeInTheDocument();
|
|
384
|
+
|
|
385
|
+
userEvent.hover(screen.getByTestId('table-body'));
|
|
386
|
+
|
|
387
|
+
expect(screen.getByTestId('tooltip-function-name')).toHaveTextContent(
|
|
388
|
+
'function_title'
|
|
389
|
+
);
|
|
390
|
+
expect(screen.getByTestId('tooltip-table')).toHaveTextContent(
|
|
391
|
+
'Self (% of total CPU)Total (% of total CPU)CPU Time:1 second (50%)2 seconds (100%)'
|
|
392
|
+
);
|
|
393
|
+
});
|
|
394
|
+
});
|
|
395
|
+
});
|