File tree Expand file tree Collapse file tree 2 files changed +70
-6
lines changed
Expand file tree Collapse file tree 2 files changed +70
-6
lines changed Original file line number Diff line number Diff line change @@ -75,11 +75,18 @@ beforeEach(addRootOverlayElement);
7575afterEach ( removeRootOverlayElement ) ;
7676
7777describe ( 'StackChart' , function ( ) {
78- it ( 'matches the snapshot' , ( ) => {
79- const { container } = setupSamples ( ) ;
78+ it ( 'matches the snapshot and can display a tooltip ' , ( ) => {
79+ const { container, getTooltip , moveMouse } = setupSamples ( ) ;
8080 const drawCalls = flushDrawLog ( ) ;
81- expect ( container . firstChild ) . toMatchSnapshot ( ) ;
82- expect ( drawCalls ) . toMatchSnapshot ( ) ;
81+ expect ( container . firstChild ) . toMatchSnapshot ( 'dom' ) ;
82+ expect ( drawCalls ) . toMatchSnapshot ( 'draw calls' ) ;
83+
84+ // It can also display a tooltip when hovering a stack.
85+ expect ( getTooltip ( ) ) . toBe ( null ) ;
86+
87+ moveMouse ( findFillTextPositionFromDrawLog ( drawCalls , 'B' ) ) ;
88+ expect ( getTooltip ( ) ) . toBeTruthy ( ) ;
89+ expect ( getTooltip ( ) ) . toMatchSnapshot ( 'tooltip' ) ;
8390 } ) ;
8491
8592 it ( 'can select a call node when clicking the chart' , function ( ) {
Original file line number Diff line number Diff line change @@ -954,7 +954,7 @@ exports[`StackChart EmptyReasons shows reasons when samples have been completely
954954</div >
955955` ;
956956
957- exports [` StackChart matches the snapshot 1` ] = `
957+ exports [` StackChart matches the snapshot and can display a tooltip: dom 1` ] = `
958958<div
959959 aria-labelledby = " stack-chart-tab-button"
960960 class = " stackChart"
@@ -1123,7 +1123,7 @@ exports[`StackChart matches the snapshot 1`] = `
11231123</div >
11241124` ;
11251125
1126- exports [` StackChart matches the snapshot 2 ` ] = `
1126+ exports [` StackChart matches the snapshot and can display a tooltip: draw calls 1 ` ] = `
11271127Array [
11281128 Array [
11291129 "set font",
@@ -1394,6 +1394,63 @@ Array [
13941394]
13951395` ;
13961396
1397+ exports [` StackChart matches the snapshot and can display a tooltip: tooltip 1` ] = `
1398+ <div
1399+ class = " tooltip"
1400+ data-testid = " tooltip"
1401+ style = " left: 164px; top: 38px;"
1402+ >
1403+ <div
1404+ class = " tooltipCallNode"
1405+ >
1406+ <div
1407+ class = " tooltipOneLine tooltipHeader"
1408+ >
1409+ <div
1410+ class = " tooltipTiming"
1411+ >
1412+ 3.0ms
1413+ </div >
1414+ <div
1415+ class = " tooltipTitle"
1416+ >
1417+ B
1418+ </div >
1419+ <div
1420+ class = " tooltipIcon"
1421+ />
1422+ </div >
1423+ <div
1424+ class = " tooltipCallNodeDetails"
1425+ >
1426+ <div
1427+ class = " tooltipDetails tooltipCallNodeDetailsLeft"
1428+ >
1429+ <div
1430+ class = " tooltipLabel"
1431+ >
1432+ Stack Type:
1433+ </div >
1434+ <div >
1435+ Native
1436+ </div >
1437+ <div
1438+ class = " tooltipLabel"
1439+ >
1440+ Category:
1441+ </div >
1442+ <div >
1443+ <span
1444+ class = " colored-square category-color-blue"
1445+ />
1446+ DOM
1447+ </div >
1448+ </div >
1449+ </div >
1450+ </div >
1451+ </div >
1452+ ` ;
1453+
13971454exports [` StackChart works when the user selects the JS allocations option 1` ] = `
13981455<body >
13991456 <div
You can’t perform that action at this time.
0 commit comments