diff --git a/src/components/network-chart/NetworkChartRow.tsx b/src/components/network-chart/NetworkChartRow.tsx index e1bb62e180..6d844477ee 100644 --- a/src/components/network-chart/NetworkChartRow.tsx +++ b/src/components/network-chart/NetworkChartRow.tsx @@ -498,6 +498,9 @@ export class NetworkChartRow extends React.PureComponent< marker={marker} threadsKey={this.props.threadsKey} restrictHeightWidth={true} + // Network Chart doesn't have sticky tooltips yet. But we should convert it + // to false once we implement sticky tooltips for the network chart. + hideFilterButton={true} /> ) : null} diff --git a/src/components/timeline/Markers.tsx b/src/components/timeline/Markers.tsx index f75f72db74..2e0e917079 100644 --- a/src/components/timeline/Markers.tsx +++ b/src/components/timeline/Markers.tsx @@ -497,6 +497,7 @@ class TimelineMarkers extends React.PureComponent { marker={hoveredMarker} threadsKey={threadsKey} restrictHeightWidth={true} + hideFilterButton={true} /> ) : null} diff --git a/src/components/timeline/TrackCustomMarkerGraph.tsx b/src/components/timeline/TrackCustomMarkerGraph.tsx index db5d254e00..dcdb40b26d 100644 --- a/src/components/timeline/TrackCustomMarkerGraph.tsx +++ b/src/components/timeline/TrackCustomMarkerGraph.tsx @@ -471,6 +471,7 @@ class TrackCustomMarkerGraphImpl extends React.PureComponent { marker={marker} threadsKey={threadIndex} restrictHeightWidth={true} + hideFilterButton={true} /> ); diff --git a/src/components/timeline/TrackNetwork.tsx b/src/components/timeline/TrackNetwork.tsx index 04f6ffb664..5740489f7a 100644 --- a/src/components/timeline/TrackNetwork.tsx +++ b/src/components/timeline/TrackNetwork.tsx @@ -409,6 +409,7 @@ class Network extends PureComponent { marker={hoveredMarker} threadsKey={threadIndex} restrictHeightWidth={true} + hideFilterButton={true} /> ) : null} diff --git a/src/components/tooltip/Marker.tsx b/src/components/tooltip/Marker.tsx index 2b2719e6f7..9d8ea59bf0 100644 --- a/src/components/tooltip/Marker.tsx +++ b/src/components/tooltip/Marker.tsx @@ -85,6 +85,7 @@ type OwnProps = { readonly marker: Marker; readonly threadsKey: ThreadsKey; readonly className?: string; + readonly hideFilterButton?: boolean; // In tooltips it can be awkward for really long and tall things to force // the layout to be huge. This option when set to true will restrict the // height of things like stacks, and the width of long things like URLs. @@ -521,8 +522,13 @@ class MarkerTooltipContents extends React.PureComponent { * a short list of rendering strategies, in the order they appear. */ override render() { - const { className, markerIndex, getMarkerLabel, getMarkerSearchTerm } = - this.props; + const { + className, + markerIndex, + getMarkerLabel, + getMarkerSearchTerm, + hideFilterButton, + } = this.props; const markerLabel = getMarkerLabel(markerIndex); const searchTerm = getMarkerSearchTerm(markerIndex); return ( @@ -532,19 +538,21 @@ class MarkerTooltipContents extends React.PureComponent { {this._maybeRenderMarkerDuration()}
{markerLabel} - -
diff --git a/src/test/components/MenuButtons.test.tsx b/src/test/components/MenuButtons.test.tsx index 9d38bc26ca..18b0d562ca 100644 --- a/src/test/components/MenuButtons.test.tsx +++ b/src/test/components/MenuButtons.test.tsx @@ -81,6 +81,7 @@ beforeEach(() => { import { shortenUrl } from '../../utils/shorten-url'; jest.mock('../../utils/shorten-url'); +import { compress } from 'firefox-profiler/utils/gz'; import { symbolicateProfile } from 'firefox-profiler/profile-logic/symbolication'; jest.mock('firefox-profiler/profile-logic/symbolication'); @@ -161,6 +162,12 @@ describe('app/MenuButtons', function () { } describe('', function () { + const FIXED_GZIP_BYTES = 1580; + + beforeEach(() => { + (compress as any).mockResolvedValue(new Uint8Array(FIXED_GZIP_BYTES)); + }); + function mockUpload() { // Create a promise with the resolve function outside of it. // const { promise, resolve: resolveUpload, reject: rejectUpload } = Promise.withResolvers(); diff --git a/src/test/components/TooltipMarker.test.tsx b/src/test/components/TooltipMarker.test.tsx index 2bb92521f0..938a5bc361 100644 --- a/src/test/components/TooltipMarker.test.tsx +++ b/src/test/components/TooltipMarker.test.tsx @@ -1333,6 +1333,49 @@ describe('TooltipMarker', function () { }); describe('filter button', () => { + function setupFilterButton(hideFilterButton: boolean) { + const profile = getProfileWithMarkers([ + ['Reflow', 1, 2, { type: 'tracing', category: 'Paint' }], + ]); + const store = storeWithProfile(profile); + const state = store.getState(); + const getMarker = selectedThreadSelectors.getMarkerGetter(state); + const markerIndexes = + selectedThreadSelectors.getFullMarkerListIndexes(state); + + render( + + + + ); + } + + it('hides the filter button when hideFilterButton is true', () => { + setupFilterButton(true); + + expect( + screen.queryByRole('button', { + name: /only show markers matching:/i, + }) + ).not.toBeInTheDocument(); + }); + + it('shows the filter button when hideFilterButton is false', () => { + setupFilterButton(false); + + expect( + screen.getByRole('button', { + name: /only show markers matching:/i, + }) + ).toBeInTheDocument(); + }); + it('shows the filter button for markers without spaces in the label', () => { // Tooltip label: "Reflow" const profile = getProfileWithMarkers([ diff --git a/src/test/components/__snapshots__/MenuButtons.test.tsx.snap b/src/test/components/__snapshots__/MenuButtons.test.tsx.snap index 944baae3a4..9e5db3c636 100644 --- a/src/test/components/__snapshots__/MenuButtons.test.tsx.snap +++ b/src/test/components/__snapshots__/MenuButtons.test.tsx.snap @@ -2305,7 +2305,7 @@ exports[`app/MenuButtons matches the snapshot for the opened panel for class="menuButtonsDownloadSize" > ( - 1.56 kB + 1.58 kB ) diff --git a/src/test/components/__snapshots__/TrackCustomMarker.test.tsx.snap b/src/test/components/__snapshots__/TrackCustomMarker.test.tsx.snap index ab6fc687f2..3234f9c988 100644 --- a/src/test/components/__snapshots__/TrackCustomMarker.test.tsx.snap +++ b/src/test/components/__snapshots__/TrackCustomMarker.test.tsx.snap @@ -30,12 +30,6 @@ exports[`TrackCustomMarker has a tooltip that matches the snapshot 1`] = ` > Marker -