From 454f8f80c2a7e0e5a0e95029d5b2020cb9ed5fcd Mon Sep 17 00:00:00 2001
From: ilkin-overleaf <100852799+ilkin-overleaf@users.noreply.github.com>
Date: Tue, 23 May 2023 10:54:25 +0300
Subject: [PATCH] Merge pull request #13117 from
overleaf/ii-history-react-changes-list-tests
[web] Add changes list tests
GitOrigin-RevId: 5a4e1ea647d737dc761e4258002e6507c76e95a9
---
.../components/change-list/changes.tsx | 22 +-
.../dropdown/menu-item/download.tsx | 14 +-
.../change-list/history-version-details.tsx | 1 +
.../change-list/history-version.tsx | 5 +-
.../change-list/label-list-item.tsx | 5 +-
.../change-list/metadata-users-list.tsx | 5 +-
.../history/components/change-list.spec.tsx | 276 ++++++++++++++++--
.../features/history/fixtures/updates.ts | 8 +-
8 files changed, 295 insertions(+), 41 deletions(-)
diff --git a/services/web/frontend/js/features/history/components/change-list/changes.tsx b/services/web/frontend/js/features/history/components/change-list/changes.tsx
index 4f94a345a6..ea5e495be3 100644
--- a/services/web/frontend/js/features/history/components/change-list/changes.tsx
+++ b/services/web/frontend/js/features/history/components/change-list/changes.tsx
@@ -14,20 +14,34 @@ function Changes({ pathnames, projectOps }: ChangesProps) {
{pathnames.map(pathname => (
-
-
+
{t('file_action_edited')}
-
{pathname}
+
+ {pathname}
+
))}
{projectOps.map((op, index) => (
-
-
+
{op.rename && t('file_action_renamed')}
{op.add && t('file_action_created')}
{op.remove && t('file_action_deleted')}
-
+
{getProjectOpDoc(op)}
diff --git a/services/web/frontend/js/features/history/components/change-list/dropdown/menu-item/download.tsx b/services/web/frontend/js/features/history/components/change-list/dropdown/menu-item/download.tsx
index 456bd142ca..70f79eff8b 100644
--- a/services/web/frontend/js/features/history/components/change-list/dropdown/menu-item/download.tsx
+++ b/services/web/frontend/js/features/history/components/change-list/dropdown/menu-item/download.tsx
@@ -1,7 +1,6 @@
import { useTranslation } from 'react-i18next'
-import { MenuItem, MenuItemProps } from 'react-bootstrap'
+import { MenuItem } from 'react-bootstrap'
import Icon from '../../../../../../shared/components/icon'
-import * as location from '../../../../../../shared/components/location'
type DownloadProps = {
projectId: string
@@ -17,19 +16,12 @@ function Download({
}: DownloadProps) {
const { t } = useTranslation()
- const handleDownloadVersion = (e: React.MouseEvent
) => {
- e.preventDefault()
- closeDropdown()
- const event = e as typeof e & { target: HTMLAnchorElement }
- location.assign(event.target.href)
- }
-
return (