Skip to content

Commit 0f2a395

Browse files
authored
Added data-cy and updated conflicting packages (#1051)
* Added data-cy * Updted conflicting packages
1 parent ae075c4 commit 0f2a395

File tree

6 files changed

+882
-708
lines changed

6 files changed

+882
-708
lines changed

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@
9090
"antd": "5.10.2",
9191
"autoprefixer": "10.4.16",
9292
"axios": "1.6.2",
93-
"babel-loader": "9.1.3",
93+
"babel-loader": "^8.2.5",
9494
"babel-plugin-istanbul": "6.1.1",
9595
"babel-plugin-js-logger": "1.0.17",
9696
"babel-plugin-macros": "3.1.0",

src/components/Attachments/Attachment.jsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ const Attachment = ({
117117

118118
return (
119119
<>
120-
<div className="ne-attachments__preview">
120+
<div className="ne-attachments__preview" data-cy="ne-attachments-wrapper">
121121
{isRenaming ? (
122122
<>
123123
<Tooltip content={newFilename} position="top">
@@ -165,9 +165,9 @@ const Attachment = ({
165165
position="top"
166166
>
167167
<Dropdown
168+
{...{ disabled }}
168169
buttonSize="small"
169170
buttonStyle="text"
170-
{...{ disabled }}
171171
icon={MenuVertical}
172172
>
173173
<Menu>

src/components/Attachments/Preview.jsx

+14-4
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import { Trans, useTranslation } from "react-i18next";
99

1010
import { convertToFileSize } from "components/Editor/MediaUploader/utils";
1111

12+
import { ATTACHMENTS_PREVIEW_DATA_CY } from "./constants";
1213
import { checkPreviewAvailability, downloadFile } from "./utils";
1314

1415
const Preview = ({
@@ -59,18 +60,27 @@ const Preview = ({
5960
if (isPreviewAvailable) {
6061
switch (contentType.split("/")[0]) {
6162
case "image":
62-
return <img src={url} />;
63+
return <img data-cy={ATTACHMENTS_PREVIEW_DATA_CY} src={url} />;
6364
case "video":
64-
return <video controls src={url} />;
65+
return (
66+
<video controls data-cy={ATTACHMENTS_PREVIEW_DATA_CY} src={url} />
67+
);
6568
case "application":
6669
case "text":
6770
if (contentType === "application/pdf") {
68-
return <iframe src={url} width="100%" />;
71+
return (
72+
<iframe
73+
data-cy={ATTACHMENTS_PREVIEW_DATA_CY}
74+
src={url}
75+
width="100%"
76+
/>
77+
);
6978
}
7079

7180
return (
7281
<DocViewer
7382
className="ne-attachments-preview__body-docviewer"
83+
data-cy={ATTACHMENTS_PREVIEW_DATA_CY}
7484
documents={[{ uri: url, fileType: contentType }]}
7585
pluginRenderers={DocViewerRenderers}
7686
config={{
@@ -102,10 +112,10 @@ const Preview = ({
102112

103113
return (
104114
<Modal
115+
{...{ onClose }}
105116
className="ne-attachments-preview"
106117
isOpen={!isEmpty(selectedAttachment)}
107118
size="fullScreen"
108-
{...{ onClose }}
109119
onKeyDown={handleKeyDown}
110120
>
111121
<Modal.Header className="ne-attachments-preview__header">

src/components/Attachments/constants.js

+2
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,5 @@ export const ATTACHMENT_OPTIONS = {
1313
RENAME: "Rename",
1414
DELETE: "Delete",
1515
};
16+
17+
export const ATTACHMENTS_PREVIEW_DATA_CY = "ne-attachments-preview-content";

src/components/Editor/Menu/Fixed/FontSizeOption.jsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ const FontSizeOption = ({ editor, tooltipContent }) => {
4343
>
4444
{FONT_SIZE_OPTIONS.map(({ label, value, key }) => (
4545
<MenuItem.Button
46-
data-cy={`neeto-editor-fixed-menu-font-size-option-${label}`}
46+
data-cy={`neeto-editor-fixed-menu-font-size-option-${key}`}
4747
key={value}
4848
onClick={() => handleClick(value)}
4949
>

0 commit comments

Comments
 (0)