testaro 35.0.3 → 35.0.5
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/package.json +1 -1
- package/testaro/focVis.js +23 -18
package/package.json
CHANGED
package/testaro/focVis.js
CHANGED
|
@@ -40,25 +40,30 @@ exports.reporter = async (page, withItems) => {
|
|
|
40
40
|
// For each locator:
|
|
41
41
|
for (const loc of all.allLocs) {
|
|
42
42
|
// Get how its element violates the rule, if it does.
|
|
43
|
-
|
|
44
|
-
const
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
43
|
+
try {
|
|
44
|
+
const isBad = await loc.evaluate(el => {
|
|
45
|
+
const isAbove = el.offsetTop + el.offsetHeight <= 0;
|
|
46
|
+
const isLeft = el.offsetLeft + el.offsetWidth <= 0;
|
|
47
|
+
return [isAbove, isLeft];
|
|
48
|
+
}, {timeout: 500});
|
|
49
|
+
// If it does:
|
|
50
|
+
if (isBad[0] || isBad[1]) {
|
|
51
|
+
// Add the locator to the array of violators.
|
|
52
|
+
let param;
|
|
53
|
+
if (isBad[0] && isBad[1]) {
|
|
54
|
+
param = 'above and to the left of';
|
|
55
|
+
}
|
|
56
|
+
else if (isBad[0]) {
|
|
57
|
+
param = 'above';
|
|
58
|
+
}
|
|
59
|
+
else {
|
|
60
|
+
param = 'to the left of';
|
|
61
|
+
}
|
|
62
|
+
all.locs.push([loc, param]);
|
|
54
63
|
}
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
}
|
|
58
|
-
else {
|
|
59
|
-
param = 'to the left of';
|
|
60
|
-
}
|
|
61
|
-
all.locs.push([loc, param]);
|
|
64
|
+
}
|
|
65
|
+
catch(error) {
|
|
66
|
+
console.log(`ERROR analyzing locator for focVis (${error.message})`);
|
|
62
67
|
}
|
|
63
68
|
}
|
|
64
69
|
// Populate and return the result.
|