@argos-ci/browser
Advanced tools
Comparing version 2.1.0 to 2.1.1
@@ -89,4 +89,14 @@ (function () { | ||
*/ function setAndBackupPosition(element, position) { | ||
element.setAttribute("data-argos-bck-position", element.style.position ?? "unset"); | ||
// Check if position is equivalent by comparing the coords before and after setting it | ||
const previousPosition = element.style.position; | ||
const previousRect = element.getBoundingClientRect(); | ||
element.style.position = position; | ||
const currentRect = element.getBoundingClientRect(); | ||
// If the position is not equivalent, restore the previous one | ||
if (previousRect.x !== currentRect.x || previousRect.y !== currentRect.y) { | ||
element.style.position = previousPosition; | ||
return; | ||
} | ||
// If the position is equivalent, keep the new position and backup the previous one | ||
element.setAttribute("data-argos-bck-position", previousPosition ?? "unset"); | ||
} | ||
@@ -93,0 +103,0 @@ /** |
{ | ||
"name": "@argos-ci/browser", | ||
"description": "Browser utilities to stabilize visual testing.", | ||
"version": "2.1.0", | ||
"version": "2.1.1", | ||
"author": "Smooth Code", | ||
@@ -48,3 +48,3 @@ "license": "MIT", | ||
}, | ||
"gitHead": "1d91294d32a09302aa8890807ddd810e14e9950b" | ||
"gitHead": "f2c984da3cf1da7e88dce8c0e90870133da4aae5" | ||
} |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
24295
461