Skip to content

Commit

Permalink
Merge pull request #1710 from jdi-testing/issue_1484-update-the-creat…
Browse files Browse the repository at this point in the history
…e-modal-window

Issue 1484: update the create custom element modal window
  • Loading branch information
KateDronova authored Apr 16, 2024
2 parents d0416d0 + d6bf64c commit 1674b17
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 7 deletions.
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"name": "JDN — Page Object Generator",
"description": "JDN – helps Test Automation Engineer to create Page Objects in the test automation framework and speed up test development",
"devtools_page": "index.html",
"version": "3.15.22",
"version": "3.15.23",
"icons": {
"128": "icon128.png"
},
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "jdn-ai-chrome-extension",
"version": "3.15.22",
"version": "3.15.23",
"description": "jdn-ai chrome extension",
"scripts": {
"start": "webpack --watch --env devenv",
Expand Down
9 changes: 5 additions & 4 deletions src/features/locators/components/LocatorEditDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -131,11 +131,11 @@ export const LocatorEditDialog: React.FC<Props> = ({
setIsEditedName(true);
};

const isLocatorFieldTouched = form.isFieldTouched('locator');

const handleCreateCustomLocator = async () => {
const isLocatorFieldTouched = form.isFieldTouched('locator');
// in case if user didn't touch locator field to avoid forceUpdate
const locatorMessage = isLocatorFieldTouched ? validationMessage : LocatorValidationWarnings.NotFound;

const fieldsValue = await form.validateFields();

const formData = {
Expand Down Expand Up @@ -213,7 +213,7 @@ export const LocatorEditDialog: React.FC<Props> = ({
};

const renderValidationWarning = () =>
isCreatingForm ? (
isCreatingForm && (!isLocatorFieldTouched || validationMessage === LocatorValidationWarnings.EmptyValue) ? (
<div className="jdn__locatorEdit-warning">
<Icon component={WarningFilled} className="ant-alert-icon" />
<Footnote>If you leave this field empty, the locator will be invalid</Footnote>
Expand Down Expand Up @@ -308,7 +308,7 @@ export const LocatorEditDialog: React.FC<Props> = ({
isOkButtonDisabled: isOkButtonDisabled,
}}
modalProps={{
title: isCreatingForm ? 'Create custom locator' : 'Edit locator',
title: isCreatingForm ? 'Create' : 'Edit locator',
open: isModalOpen,
onOk: isCreatingForm ? handleCreateCustomLocator : handleEditLocator,
enableOverlay: isModalOpen,
Expand All @@ -317,6 +317,7 @@ export const LocatorEditDialog: React.FC<Props> = ({
disabled: isOkButtonDisabled,
},
width: 580,
okText: isCreatingForm ? 'Add to the list' : 'OK',
}}
formProps={{
form,
Expand Down

0 comments on commit 1674b17

Please sign in to comment.