From 3eca71bc8498e580741d6096145ea18902e6bd2f Mon Sep 17 00:00:00 2001 From: Kerry Date: Thu, 27 Jan 2022 09:55:08 +0100 Subject: [PATCH] Unit test ExportDialog (#7619) * add test ids to dialog buttons Signed-off-by: Kerry Archibald * unit test ExportDialog Signed-off-by: Kerry Archibald * remove extra snapshot Signed-off-by: Kerry Archibald * fix bad snapshots Signed-off-by: Kerry Archibald * remove wrappers from snapshot Signed-off-by: Kerry Archibald --- src/components/views/dialogs/ExportDialog.tsx | 8 +- .../views/elements/DialogButtons.tsx | 2 + .../views/elements/StyledCheckbox.tsx | 3 +- .../views/dialogs/ExportDialog-test.tsx | 253 ++ .../__snapshots__/ExportDialog-test.tsx.snap | 2912 +++++++++++++++++ 5 files changed, 3175 insertions(+), 3 deletions(-) create mode 100644 test/components/views/dialogs/ExportDialog-test.tsx create mode 100644 test/components/views/dialogs/__snapshots__/ExportDialog-test.tsx.snap diff --git a/src/components/views/dialogs/ExportDialog.tsx b/src/components/views/dialogs/ExportDialog.tsx index 4bbd68071a..cfbd6af1bf 100644 --- a/src/components/views/dialogs/ExportDialog.tsx +++ b/src/components/views/dialogs/ExportDialog.tsx @@ -138,7 +138,7 @@ const ExportDialog: React.FC = ({ room, onFinished }) => { }, invalid: () => { const min = 1; - const max = 10 ** 8; + const max = 2000; return _t("Enter a number between %(min)s and %(max)s", { min, max, @@ -239,6 +239,7 @@ const ExportDialog: React.FC = ({ room, onFinished }) => { if (exportType === ExportType.LastNMessages) { messageCount = ( = ({ room, onFinished }) => { { @@ -350,6 +352,7 @@ const ExportDialog: React.FC = ({ room, onFinished }) => { = ({ room, onFinished }) => { /> setAttachments( @@ -372,7 +376,7 @@ const ExportDialog: React.FC = ({ room, onFinished }) => { { isExporting ? ( -
+

{ exportProgressText } diff --git a/src/components/views/elements/DialogButtons.tsx b/src/components/views/elements/DialogButtons.tsx index 210e768aa7..480e364630 100644 --- a/src/components/views/elements/DialogButtons.tsx +++ b/src/components/views/elements/DialogButtons.tsx @@ -83,6 +83,7 @@ export default class DialogButtons extends React.Component { cancelButton = + +

+
+ } + onActivation={[Function]} + onDeactivation={[Function]} + persistentFocus={false} + returnFocus={[Function]} + shards={Array []} + sideCar={ + Object { + "assignMedium": [Function], + "assignSyncMedium": [Function], + "options": Object { + "async": true, + "ssr": false, + }, + "read": [Function], + "useMedium": [Function], + } + } + > + +
+

+ Export Chat +

+
+
+

+ Select from the options below to export chats from your timeline +

+ + Format + +
+