@empiricalrun/test-gen 0.38.10 → 0.38.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @empiricalrun/test-gen
2
2
 
3
+ ## 0.38.11
4
+
5
+ ### Patch Changes
6
+
7
+ - fb4c866: fix: parent and child elements getting highlighted
8
+
3
9
  ## 0.38.10
4
10
 
5
11
  ### Patch Changes
@@ -157,10 +157,27 @@ function annotateClickableElements(options = {}) {
157
157
  isClickable = true;
158
158
  }
159
159
 
160
+ // Tag-specific clickability
161
+ const focusableTags = [
162
+ "a",
163
+ "button",
164
+ "input",
165
+ "select",
166
+ "textarea",
167
+ "object",
168
+ "embed",
169
+ "label",
170
+ "details",
171
+ ];
172
+
160
173
  // Check for onclick attribute or listener
161
174
  if (
162
- element.hasAttribute("onclick") ||
163
- typeof element.onclick === "function"
175
+ (element.hasAttribute("onclick") ||
176
+ typeof element.onclick === "function")
177
+ // check for parent element having same on click
178
+ && element.parentNode.onclick !== element.onclick
179
+ // parent element should not be a focusable tag like button
180
+ && focusableTags.indexOf(element.parentNode.tagName.toLowerCase()) === -1
164
181
  ) {
165
182
  isClickable = true;
166
183
  }
@@ -210,18 +227,7 @@ function annotateClickableElements(options = {}) {
210
227
  }
211
228
  }
212
229
 
213
- // Tag-specific clickability
214
- const focusableTags = [
215
- "a",
216
- "button",
217
- "input",
218
- "select",
219
- "textarea",
220
- "object",
221
- "embed",
222
- "label",
223
- "details",
224
- ];
230
+
225
231
  if (focusableTags.includes(tagName)) {
226
232
  switch (tagName) {
227
233
  case "a":
@@ -157,10 +157,27 @@ function annotateClickableElements(options = {}) {
157
157
  isClickable = true;
158
158
  }
159
159
 
160
+ // Tag-specific clickability
161
+ const focusableTags = [
162
+ "a",
163
+ "button",
164
+ "input",
165
+ "select",
166
+ "textarea",
167
+ "object",
168
+ "embed",
169
+ "label",
170
+ "details",
171
+ ];
172
+
160
173
  // Check for onclick attribute or listener
161
174
  if (
162
- element.hasAttribute("onclick") ||
163
- typeof element.onclick === "function"
175
+ (element.hasAttribute("onclick") ||
176
+ typeof element.onclick === "function")
177
+ // check for parent element having same on click
178
+ && element.parentNode.onclick !== element.onclick
179
+ // parent element should not be a focusable tag like button
180
+ && focusableTags.indexOf(element.parentNode.tagName.toLowerCase()) === -1
164
181
  ) {
165
182
  isClickable = true;
166
183
  }
@@ -210,18 +227,7 @@ function annotateClickableElements(options = {}) {
210
227
  }
211
228
  }
212
229
 
213
- // Tag-specific clickability
214
- const focusableTags = [
215
- "a",
216
- "button",
217
- "input",
218
- "select",
219
- "textarea",
220
- "object",
221
- "embed",
222
- "label",
223
- "details",
224
- ];
230
+
225
231
  if (focusableTags.includes(tagName)) {
226
232
  switch (tagName) {
227
233
  case "a":
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@empiricalrun/test-gen",
3
- "version": "0.38.10",
3
+ "version": "0.38.11",
4
4
  "publishConfig": {
5
5
  "registry": "https://registry.npmjs.org/",
6
6
  "access": "public"
@@ -58,9 +58,9 @@
58
58
  "ts-morph": "^23.0.0",
59
59
  "tsx": "^4.16.2",
60
60
  "typescript": "^5.3.3",
61
+ "@empiricalrun/llm": "^0.9.25",
61
62
  "@empiricalrun/r2-uploader": "^0.3.6",
62
- "@empiricalrun/reporter": "^0.21.3",
63
- "@empiricalrun/llm": "^0.9.25"
63
+ "@empiricalrun/reporter": "^0.21.3"
64
64
  },
65
65
  "devDependencies": {
66
66
  "@types/detect-port": "^1.3.5",