Skip to content

Commit

Permalink
Merge pull request #1725 from jdi-testing/issue_1701-fix-locators-edi…
Browse files Browse the repository at this point in the history
…ting

Issue 1701: fix locators editing
  • Loading branch information
KateDronova authored Apr 26, 2024
2 parents ae9e3bd + 14ef296 commit cd8c760
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 10 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.25",
"version": "3.15.26",
"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.25",
"version": "3.15.26",
"description": "jdn-ai chrome extension",
"scripts": {
"start": "webpack --watch --env devenv",
Expand Down
10 changes: 8 additions & 2 deletions src/features/locators/components/LocatorEditDialog.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, { useEffect, useState } from 'react';
import { Form, Input, Select } from 'antd';
import { Form, Input, Select, Space } from 'antd';
import Icon from '@ant-design/icons';
import WarningFilled from '../assets/warning-filled.svg';
import { FieldData } from 'rc-field-form/lib/interface';
Expand Down Expand Up @@ -356,9 +356,15 @@ export const LocatorEditDialog: React.FC<Props> = ({
>
<Select
onChange={handleLocatorDropdownOnChange}
options={locatorTypeOptions}
popupClassName="custom-divider-for-dropdown"
virtual={false}
options={locatorTypeOptions}
optionRender={(option) => (
<Space>
{option.data.label}
<span style={{ color: 'rgba(0, 0, 0, 0.45)' }}>{option.data.desc}</span>
</Space>
)}
/>
</Form.Item>
<Form.Item
Expand Down
8 changes: 3 additions & 5 deletions src/features/locators/utils/createLocatorTypeOptions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import { evaluateLocator } from './utils';
interface IOptionsWithLabel {
label: React.JSX.Element;
value: string;
desc: string;
disabled?: boolean;
}

Expand All @@ -33,11 +34,7 @@ const generateOptionsWithLabel = (attributes: ElementAttributes): IOptionsWithLa
);
}

return (
<>
{locatorType} <span style={{ color: 'rgba(0, 0, 0, 0.45)' }}>{`"${attribute}"`}</span>
</>
);
return <>{locatorType}</>;
};

return Object.keys(attributes).map((key) => {
Expand All @@ -46,6 +43,7 @@ const generateOptionsWithLabel = (attributes: ElementAttributes): IOptionsWithLa
const option: IOptionsWithLabel = {
label: generateLabel(locatorType, attributes[key as keyof ElementAttributes] as string),
value: locatorType,
desc: attributes[key as keyof ElementAttributes] as string,
};

if (attributes[key as keyof ElementAttributes] === null) {
Expand Down

0 comments on commit cd8c760

Please sign in to comment.