@@ -99,6 +168,35 @@ class MarkerSettingsImpl extends PureComponent
{
) : null}
+ {copyTable ? (
+
+
+
+ ) : null}
+ {copyTableWarning !== null ? (
+
+
+
+
+ {copyTableWarning}
+
+
+
+
+ ) : null}
{
onShow={this._onShowFiltersContextMenu}
onHide={this._onHideFiltersContextMenu}
/>
+
);
}
}
-export const MarkerSettings = explicitConnect<{}, StateProps, DispatchProps>({
+export const MarkerSettings = explicitConnect<
+ OwnProps,
+ StateProps,
+ DispatchProps
+>({
mapStateToProps: (state) => ({
searchString: getMarkersSearchString(state),
allowSwitchingStackType: getProfileUsesMultipleStackTypes(state),
diff --git a/src/test/components/MarkerTable.test.tsx b/src/test/components/MarkerTable.test.tsx
index 2d381ff82a..8133884e6c 100644
--- a/src/test/components/MarkerTable.test.tsx
+++ b/src/test/components/MarkerTable.test.tsx
@@ -515,6 +515,54 @@ describe('MarkerTable', function () {
expect(firstColumn).toHaveStyle({ width: '90px' });
});
});
+
+ it('can copy the table as plain text', () => {
+ const { container } = setup();
+
+ const button = ensureExists(
+ container.querySelector('.copyTableButton')
+ ) as HTMLElement;
+ fireFullClick(button);
+
+ const menu = ensureExists(
+ container.querySelector('.markerCopyTableContextMenu')
+ ) as HTMLElement;
+
+ const items = menu.querySelectorAll('[role="menuitem"]');
+ expect(items.length).toBe(2);
+
+ fireFullClick(items[0] as HTMLElement);
+
+ const pattern = new RegExp(
+ '^ +Start +Duration +Name +Details\\n +0s +0s +UserTiming +foobar\\n'
+ );
+ expect(copy).toHaveBeenLastCalledWith(expect.stringMatching(pattern));
+ });
+
+ it('can copy the table as markdown', () => {
+ const { container } = setup();
+
+ const button = ensureExists(
+ container.querySelector('.copyTableButton')
+ ) as HTMLElement;
+ fireFullClick(button);
+
+ const menu = ensureExists(
+ container.querySelector('.markerCopyTableContextMenu')
+ ) as HTMLElement;
+
+ const items = menu.querySelectorAll('[role="menuitem"]');
+ expect(items.length).toBe(2);
+
+ fireFullClick(items[1] as HTMLElement);
+
+ const pattern = new RegExp(
+ '^\\| +Start +\\| +Duration +\\| +Name +\\| +Details +\\|\\n' +
+ '\\|-+:\\|-+:\\|-+:\\|-+\\|\\n' +
+ '\\| +0s +\\| +0s +\\| +UserTiming +\\| +foobar +\\|\\n'
+ );
+ expect(copy).toHaveBeenLastCalledWith(expect.stringMatching(pattern));
+ });
});
function getReflowMarker(
diff --git a/src/test/components/__snapshots__/MarkerChart.test.tsx.snap b/src/test/components/__snapshots__/MarkerChart.test.tsx.snap
index 68263b885b..921e5dc818 100644
--- a/src/test/components/__snapshots__/MarkerChart.test.tsx.snap
+++ b/src/test/components/__snapshots__/MarkerChart.test.tsx.snap
@@ -553,6 +553,31 @@ exports[`MarkerChart renders the normal marker chart and matches the snapshot 1`
+