Skip to content

Commit

Permalink
Merge pull request #300 from jdi-testing/issue_263_264
Browse files Browse the repository at this point in the history
fix controls naming
  • Loading branch information
MariiaNebesnova authored Aug 24, 2021
2 parents 1300efd + c547b02 commit 8413f0e
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 9 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",
"description": "",
"devtools_page": "index.html",
"version": "3.0.42",
"version": "3.0.43",
"permissions": [
"activeTab",
"tabs",
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "jdi-react-extension",
"version": "3.0.42",
"version": "3.0.43",
"description": "jdi react extension",
"scripts": {
"start": "npm run webpack",
Expand Down
16 changes: 9 additions & 7 deletions src/js/blocks/autoFind/autoFindProvider/pageObject.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { camelCase } from "../../../models/GenerateBlockModel";
import { getJDILabel } from "./generationClassesMap";
import { connector } from "./connector";
import { startsWith } from "lodash";

const getPackage = (url) => {
const urlObject = new URL(url);
Expand All @@ -25,18 +26,19 @@ export const predictedToConvert = (elements) => {

return f.map((e, i) => {
let elementName = getElementName(e);
let elementTagId = e.predictedAttrId;
let customElementName = e.jdi_custom_class_name;
let elementTagId = e.predictedAttrId.replaceAll(" ", "");
elementTagId = startsWith(elementTagId, '^[0-9].+$') ? `name${elementTagId}` : elementTagId;
const customElementName = e.jdi_custom_class_name;

if (uniqueNames.indexOf(elementName) >= 0) elementName += i;
if (elementTagId && uniqueNames.indexOf(elementTagId) >= 0) elementTagId += i;
uniqueNames.push(elementTagId, elementName);

const name = customElementName
? customElementName
: elementTagId
? elementTagId
: elementName;
const name = customElementName ?
customElementName :
elementTagId ?
elementTagId :
elementName;

return {
...e,
Expand Down

0 comments on commit 8413f0e

Please sign in to comment.