@applitools/snippets 2.2.0 → 2.2.3

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.
@@ -6,15 +6,15 @@
6
6
  "cleanupPageMarker": "function(arg){var s=function(){\"use strict\";var t=function(t){var e=void 0===t?[]:t,r=e[0],o=e[1],n=Object.keys(o).sort(),a=n.reduce((function(t,e){return t[e]={value:r.style.getPropertyValue(e),important:Boolean(r.style.getPropertyPriority(e))},t}),{});return n.forEach((function(t){r.style.setProperty(t,\"string\"!=typeof o[t]&&o[t]?o[t].value:o[t],o[t]&&o[t].important?\"important\":\"\")})),a};return function(){var e=document.querySelector(\"[data-applitools-marker]\");e&&document.body.removeChild(e);var r=document.documentElement.getAttribute(\"data-applitools-original-transforms\"),o=document.body.getAttribute(\"data-applitools-original-transforms\");r&&t([document.documentElement,JSON.parse(r)]),o&&t([document.body,JSON.parse(o)])}}();\nreturn s(arg)}",
7
7
  "focusElement": "function(arg){var s=function(){\"use strict\";return function(n){var r=(void 0===n?[]:n)[0];r&&r.focus()}}();\nreturn s(arg)}",
8
8
  "getChildFramesInfo": "function(arg){var s=function(){\"use strict\";return function(){var r=document.querySelectorAll(\"frame, iframe\");return Array.prototype.map.call(r,(function(r){return[r,!r.contentDocument,r.src]}))}}();\nreturn s(arg)}",
9
- "getContextInfo": "function(arg){var s=function(){\"use strict\";var t=function(t){var n=(void 0===t?[]:t)[0],e=\"\",r=n.ownerDocument;if(!r)return e;for(var o=n;o!==r;){var a=Array.prototype.filter.call(o.parentNode.childNodes,(function(t){return t.tagName===o.tagName})).indexOf(o);e=\"/\"+o.tagName+\"[\"+(a+1)+\"]\"+e,o=o.parentNode}return e};return function(){var n,e,r;try{n=window.top.document===window.document}catch(t){n=!1}try{e=!window.parent.document===window.document}catch(t){e=!0}if(!e)try{r=t([window.frameElement])}catch(t){r=null}return[document.documentElement,r,n,e]}}();\nreturn s(arg)}",
9
+ "getContextInfo": "function(arg){var s=function(){\"use strict\";var t=function(t){var n=(void 0===t?[]:t)[0],e=\"\",r=n.ownerDocument;if(!r)return e;for(var o=n;o!==r;){var a=Array.prototype.filter.call(o.parentNode.childNodes,(function(t){return t.tagName===o.tagName})).indexOf(o);e=\"/\"+o.tagName+\"[\"+(a+1)+\"]\"+e,o=o.parentNode}return e};return function(){var n,e,r;try{n=window.top.document===window.document||\"root-context\"===window.document[\"applitools-marker\"]}catch(t){n=!1}try{e=!window.parent.document===window.document}catch(t){e=!0}if(!e)try{r=t([window.frameElement])}catch(t){r=null}return[document.documentElement,r,n,e]}}();\nreturn s(arg)}",
10
10
  "getDocumentScrollingElement": "function(arg){var s=function(){\"use strict\";return function(){var t=\"HTML\",e=document.scrollingElement;return e&&(t=e.tagName),t.toLowerCase()}}();\nreturn s(arg)}",
11
11
  "getDocumentSize": "function(arg){var s=function(){\"use strict\";return function(){var t=document.documentElement.scrollWidth,e=document.documentElement.scrollHeight,n=document.documentElement.clientHeight,c=document.body.scrollWidth,o=document.body.scrollHeight,d=document.body.clientHeight;return{width:Math.max(t,c),height:Math.max(n,e,d,o)}}}();\nreturn s(arg)}",
12
12
  "getElementComputedStyleProperties": "function(arg){var s=function(){\"use strict\";return function(t){var r=void 0===t?[]:t,e=r[0],n=r[1],u=void 0===n?[]:n,o=window.getComputedStyle(e);return o?u.map((function(t){return o.getPropertyValue(t)})):[]}}();\nreturn s(arg)}",
13
- "getElementContentSize": "function(arg){var s=function(){\"use strict\";var t=function(t){var r=void 0===t?[]:t,e=r[0],n=r[1],o=Object.keys(n).sort(),i=o.reduce((function(t,r){return t[r]={value:e.style.getPropertyValue(r),important:Boolean(e.style.getPropertyPriority(r))},t}),{});return o.forEach((function(t){e.style.setProperty(t,\"string\"!=typeof n[t]&&n[t]?n[t].value:n[t],n[t]&&n[t].important?\"important\":\"\")})),i};return function(r){var e,n=(void 0===r?[]:r)[0];n===document.documentElement&&(e=t([n,{transform:\"none\"}]));var o={width:n.scrollWidth,height:n.scrollHeight};return e&&t([n,e]),o}}();\nreturn s(arg)}",
13
+ "getElementContentSize": "function(arg){var s=function(){\"use strict\";var t=function(t){var e=void 0===t?[]:t,r=e[0],o=e[1],n=Object.keys(o).sort(),a=n.reduce((function(t,e){return t[e]={value:r.style.getPropertyValue(e),important:Boolean(r.style.getPropertyPriority(e))},t}),{});return n.forEach((function(t){r.style.setProperty(t,\"string\"!=typeof o[t]&&o[t]?o[t].value:o[t],o[t]&&o[t].important?\"important\":\"\")})),a};return function(e){var r,o,n,a=(void 0===e?[]:e)[0];a!==document.documentElement&&a.tagName.toLowerCase()!==(o=\"HTML\",(n=document.scrollingElement)&&(o=n.tagName),o.toLowerCase())||(r=t([a,{transform:\"none\"}]));var i={width:a.scrollWidth,height:a.scrollHeight};return r&&t([a,r]),i}}();\nreturn s(arg)}",
14
14
  "getElementFixedAncestor": "function(arg){var s=function(){\"use strict\";return function(t){for(var e=(void 0===t?[]:t)[0];e.offsetParent&&e.offsetParent!==document.body&&e.offsetParent!==document.documentElement;)e=e.offsetParent;return\"fixed\"===window.getComputedStyle(e).getPropertyValue(\"position\")?e:null}}();\nreturn s(arg)}",
15
15
  "getElementInnerOffset": "function(arg){var s=function(){\"use strict\";var r=function(r){var t=(void 0===r?[]:r)[0];return t?{x:t.scrollLeft,y:t.scrollTop}:{x:window.scrollX||window.pageXOffset,y:window.scrollY||window.pageYOffset}};var t=function(r){var t=void 0===r?[]:r,e=t[0],o=t[1];return(void 0===o?[]:o).reduce((function(r,t){return r[t]={value:e.style.getPropertyValue(t),important:Boolean(e.style.getPropertyPriority(t))},r}),{})};var e=function(r){var e=(void 0===r?[]:r)[0],o=void 0===e?document.documentElement:e,n=t([o,[\"transform\",\"-webkit-transform\"]]),i=Object.keys(n).reduce((function(r,t){var e=n[t].value;if(e){var o=e.match(/^translate\\s*\\(\\s*(\\-?[\\d, \\.]+)px\\s*(,\\s*(-?[\\d, \\.]+)px)?\\s*\\)/);if(o){var i=o[1],a=void 0!==o[3]?o[3]:0;r.push({x:Math.round(-parseFloat(i)),y:Math.round(-parseFloat(a))})}else r.push({x:0,y:0})}return r}),[]);if(!i.every((function(r){return i[0].x===r.x||i[0].y===r.y})))throw new Error(\"Got different css positions!\");return i[0]||{x:0,y:0}};return function(t){var o=(void 0===t?[]:t)[0],n=r([o]),i=e([o]);return{x:n.x+i.x,y:n.y+i.y}}}();\nreturn s(arg)}",
16
16
  "getElementProperties": "function(arg){var s=function(){\"use strict\";return function(r){var n=void 0===r?[]:r,t=n[0],u=n[1];return(void 0===u?[]:u).reduce((function(r,n){return r[n]=t[n],r}),{})}}();\nreturn s(arg)}",
17
- "getElementRect": "function(arg){var s=function(){\"use strict\";var t=function(t){for(var e=(void 0===t?[]:t)[0];e.offsetParent&&e.offsetParent!==document.body&&e.offsetParent!==document.documentElement;)e=e.offsetParent;return\"fixed\"===window.getComputedStyle(e).getPropertyValue(\"position\")?e:null};var e=function(t){var e=(void 0===t?[]:t)[0];return e?{x:e.scrollLeft,y:e.scrollTop}:{x:window.scrollX||window.pageXOffset,y:window.scrollY||window.pageYOffset}};var r=function(t){var e=void 0===t?[]:t,r=e[0],o=e[1];return(void 0===o?[]:o).reduce((function(t,e){return t[e]={value:r.style.getPropertyValue(e),important:Boolean(r.style.getPropertyPriority(e))},t}),{})};var o=function(t){var e=(void 0===t?[]:t)[0],o=void 0===e?document.documentElement:e,n=r([o,[\"transform\",\"-webkit-transform\"]]),i=Object.keys(n).reduce((function(t,e){var r=n[e].value;if(r){var o=r.match(/^translate\\s*\\(\\s*(\\-?[\\d, \\.]+)px\\s*(,\\s*(-?[\\d, \\.]+)px)?\\s*\\)/);if(o){var i=o[1],a=void 0!==o[3]?o[3]:0;t.push({x:Math.round(-parseFloat(i)),y:Math.round(-parseFloat(a))})}else t.push({x:0,y:0})}return t}),[]);if(!i.every((function(t){return i[0].x===t.x||i[0].y===t.y})))throw new Error(\"Got different css positions!\");return i[0]||{x:0,y:0}};var n=function(t){var r=(void 0===t?[]:t)[0],n=e([r]),i=o([r]);return{x:n.x+i.x,y:n.y+i.y}};return function(e){var r=void 0===e?[]:e,o=r[0],i=r[1],a=void 0!==i&&i;if(o===document.scrollingElement)return{x:0,y:0,width:o.clientWidth,height:o.clientHeight};var d=o.getBoundingClientRect(),u={x:d.left,y:d.top,width:d.width,height:d.height};if(a){var f=window.getComputedStyle(o);u.x+=parseInt(f.getPropertyValue(\"border-left-width\")),u.y+=parseInt(f.getPropertyValue(\"border-top-width\")),u.width=o.clientWidth,u.height=o.clientHeight}var l=t([o]);if(l){if(l!==o){var s=n([l]);u.x+=s.x,u.y+=s.y}}else{var v=n();u.x+=v.x,u.y+=v.y}return u}}();\nreturn s(arg)}",
17
+ "getElementRect": "function(arg){var s=function(){\"use strict\";var t=function(t){for(var e=(void 0===t?[]:t)[0];e.offsetParent&&e.offsetParent!==document.body&&e.offsetParent!==document.documentElement;)e=e.offsetParent;return\"fixed\"===window.getComputedStyle(e).getPropertyValue(\"position\")?e:null};var e=function(t){var e=(void 0===t?[]:t)[0];return e?{x:e.scrollLeft,y:e.scrollTop}:{x:window.scrollX||window.pageXOffset,y:window.scrollY||window.pageYOffset}};var r=function(t){var e=void 0===t?[]:t,r=e[0],o=e[1];return(void 0===o?[]:o).reduce((function(t,e){return t[e]={value:r.style.getPropertyValue(e),important:Boolean(r.style.getPropertyPriority(e))},t}),{})};var o=function(t){var e=(void 0===t?[]:t)[0],o=void 0===e?document.documentElement:e,n=r([o,[\"transform\",\"-webkit-transform\"]]),i=Object.keys(n).reduce((function(t,e){var r=n[e].value;if(r){var o=r.match(/^translate\\s*\\(\\s*(\\-?[\\d, \\.]+)px\\s*(,\\s*(-?[\\d, \\.]+)px)?\\s*\\)/);if(o){var i=o[1],a=void 0!==o[3]?o[3]:0;t.push({x:Math.round(-parseFloat(i)),y:Math.round(-parseFloat(a))})}else t.push({x:0,y:0})}return t}),[]);if(!i.every((function(t){return i[0].x===t.x||i[0].y===t.y})))throw new Error(\"Got different css positions!\");return i[0]||{x:0,y:0}};var n=function(t){var r=(void 0===t?[]:t)[0],n=e([r]),i=o([r]);return{x:n.x+i.x,y:n.y+i.y}};return function(e){var r,o,i=void 0===e?[]:e,a=i[0],d=i[1],u=void 0!==d&&d;if(a===document.documentElement||a.tagName.toLowerCase()===(r=\"HTML\",(o=document.scrollingElement)&&(r=o.tagName),r.toLowerCase()))return{x:0,y:0,width:a.clientWidth,height:a.clientHeight};var s=a.getBoundingClientRect(),l={x:s.left,y:s.top,width:s.width,height:s.height};if(u){var f=window.getComputedStyle(a);l.x+=parseInt(f.getPropertyValue(\"border-left-width\")),l.y+=parseInt(f.getPropertyValue(\"border-top-width\")),l.width=a.clientWidth,l.height=a.clientHeight}var c=t([a]);if(c){if(c!==a){var v=n([c]);l.x+=v.x,l.y+=v.y}}else{var y=n();l.x+=y.x,l.y+=y.y}return l}}();\nreturn s(arg)}",
18
18
  "getElementScrollOffset": "function(arg){var s=function(){\"use strict\";return function(o){var r=(void 0===o?[]:o)[0];return r?{x:r.scrollLeft,y:r.scrollTop}:{x:window.scrollX||window.pageXOffset,y:window.scrollY||window.pageYOffset}}}();\nreturn s(arg)}",
19
19
  "getElementStyleProperties": "function(arg){var s=function(){\"use strict\";return function(r){var t=void 0===r?[]:r,e=t[0],n=t[1];return(void 0===n?[]:n).reduce((function(r,t){return r[t]={value:e.style.getPropertyValue(t),important:Boolean(e.style.getPropertyPriority(t))},r}),{})}}();\nreturn s(arg)}",
20
20
  "getElementTranslateOffset": "function(arg){var s=function(){\"use strict\";var r=function(r){var t=void 0===r?[]:r,e=t[0],n=t[1];return(void 0===n?[]:n).reduce((function(r,t){return r[t]={value:e.style.getPropertyValue(t),important:Boolean(e.style.getPropertyPriority(t))},r}),{})};return function(t){var e=(void 0===t?[]:t)[0],n=void 0===e?document.documentElement:e,o=r([n,[\"transform\",\"-webkit-transform\"]]),u=Object.keys(o).reduce((function(r,t){var e=o[t].value;if(e){var n=e.match(/^translate\\s*\\(\\s*(\\-?[\\d, \\.]+)px\\s*(,\\s*(-?[\\d, \\.]+)px)?\\s*\\)/);if(n){var u=n[1],a=void 0!==n[3]?n[3]:0;r.push({x:Math.round(-parseFloat(u)),y:Math.round(-parseFloat(a))})}else r.push({x:0,y:0})}return r}),[]);if(!u.every((function(r){return u[0].x===r.x||u[0].y===r.y})))throw new Error(\"Got different css positions!\");return u[0]||{x:0,y:0}}}();\nreturn s(arg)}",
@@ -24,7 +24,7 @@
24
24
  "getUserAgent": "function(arg){var s=function(){\"use strict\";return function(){return window.navigator.userAgent}}();\nreturn s(arg)}",
25
25
  "getViewportScale": "function(arg){var s=function(){\"use strict\";return function(){return window.visualViewport&&window.visualViewport.scale}}();\nreturn s(arg)}",
26
26
  "getViewportSize": "function(arg){var s=function(){\"use strict\";return function(){var e=0,t=0;return window.innerHeight?t=window.innerHeight:document.documentElement&&document.documentElement.clientHeight?t=document.documentElement.clientHeight:document.body&&document.body.clientHeight&&(t=document.body.clientHeight),window.innerWidth?e=window.innerWidth:document.documentElement&&document.documentElement.clientWidth?e=document.documentElement.clientWidth:document.body&&document.body.clientWidth&&(e=document.body.clientWidth),{width:e,height:t}}}();\nreturn s(arg)}",
27
- "isElementScrollable": "function(arg){var s=function(){\"use strict\";return function(t){var i=(void 0===t?[]:t)[0];return i.scrollWidth>i.clientWidth||i.scrollHeight>i.clientHeight}}();\nreturn s(arg)}",
27
+ "isElementScrollable": "function(arg){var s=function(){\"use strict\";var t=function(t){var o=void 0===t?[]:t,r=o[0],e=o[1],i=void 0===e?[]:e,n=window.getComputedStyle(r);return n?i.map((function(t){return n.getPropertyValue(t)})):[]};return function(o){var r=(void 0===o?[]:o)[0],e=t([r,[\"overflow-x\",\"overflow-y\",\"overflow\"]]);return(\"scroll\"===e[0]||\"auto\"===e[0]||\"hidden\"===e[2])&&r.scrollWidth>r.clientWidth||(\"scroll\"===e[1]||\"auto\"===e[1]||\"hidden\"===e[2])&&r.scrollHeight>r.clientHeight}}();\nreturn s(arg)}",
28
28
  "isEqualElements": "function(arg){var s=function(){\"use strict\";return function(r){var n=void 0===r?[]:r;return n[0]===n[1]}}();\nreturn s(arg)}",
29
29
  "scrollTo": "function(arg){var s=function(){\"use strict\";var t=function(t){var r=void 0===t?[]:t,o=r[0],e=r[1],l=Object.keys(e).sort(),n=l.reduce((function(t,r){return t[r]={value:o.style.getPropertyValue(r),important:Boolean(o.style.getPropertyPriority(r))},t}),{});return l.forEach((function(t){o.style.setProperty(t,\"string\"!=typeof e[t]&&e[t]?e[t].value:e[t],e[t]&&e[t].important?\"important\":\"\")})),n};return function(r){var o=void 0===r?[]:r,e=o[0],l=o[1];e=e||document.documentElement;var n=t([e,{\"scroll-behavior\":{value:\"auto\",important:!0}}]);return e.scrollTo?e.scrollTo(l.x,l.y):(e.scrollLeft=l.x,e.scrollTop=l.y),t([e,n]),{x:e.scrollLeft,y:e.scrollTop}}}();\nreturn s(arg)}",
30
30
  "setElementAttributes": "function(arg){var s=function(){\"use strict\";return function(t){var e=void 0===t?[]:t,r=e[0],u=e[1];return Object.keys(u).reduce((function(t,e){return t[e]=r.getAttribute(e),r.setAttribute(e,u[e]),t}),{})}}();\nreturn s(arg)}",
package/dist/index.js CHANGED
@@ -27,7 +27,7 @@ var s=function(){"use strict";return function(){var r=document.querySelectorAll(
27
27
  return s(arg)
28
28
  }
29
29
  exports.getContextInfo=function(arg){
30
- var s=function(){"use strict";var t=function(t){var n=(void 0===t?[]:t)[0],e="",r=n.ownerDocument;if(!r)return e;for(var o=n;o!==r;){var a=Array.prototype.filter.call(o.parentNode.childNodes,(function(t){return t.tagName===o.tagName})).indexOf(o);e="/"+o.tagName+"["+(a+1)+"]"+e,o=o.parentNode}return e};return function(){var n,e,r;try{n=window.top.document===window.document}catch(t){n=!1}try{e=!window.parent.document===window.document}catch(t){e=!0}if(!e)try{r=t([window.frameElement])}catch(t){r=null}return[document.documentElement,r,n,e]}}();
30
+ var s=function(){"use strict";var t=function(t){var n=(void 0===t?[]:t)[0],e="",r=n.ownerDocument;if(!r)return e;for(var o=n;o!==r;){var a=Array.prototype.filter.call(o.parentNode.childNodes,(function(t){return t.tagName===o.tagName})).indexOf(o);e="/"+o.tagName+"["+(a+1)+"]"+e,o=o.parentNode}return e};return function(){var n,e,r;try{n=window.top.document===window.document||"root-context"===window.document["applitools-marker"]}catch(t){n=!1}try{e=!window.parent.document===window.document}catch(t){e=!0}if(!e)try{r=t([window.frameElement])}catch(t){r=null}return[document.documentElement,r,n,e]}}();
31
31
  return s(arg)
32
32
  }
33
33
  exports.getDocumentScrollingElement=function(arg){
@@ -43,7 +43,7 @@ var s=function(){"use strict";return function(t){var r=void 0===t?[]:t,e=r[0],n=
43
43
  return s(arg)
44
44
  }
45
45
  exports.getElementContentSize=function(arg){
46
- var s=function(){"use strict";var t=function(t){var r=void 0===t?[]:t,e=r[0],n=r[1],o=Object.keys(n).sort(),i=o.reduce((function(t,r){return t[r]={value:e.style.getPropertyValue(r),important:Boolean(e.style.getPropertyPriority(r))},t}),{});return o.forEach((function(t){e.style.setProperty(t,"string"!=typeof n[t]&&n[t]?n[t].value:n[t],n[t]&&n[t].important?"important":"")})),i};return function(r){var e,n=(void 0===r?[]:r)[0];n===document.documentElement&&(e=t([n,{transform:"none"}]));var o={width:n.scrollWidth,height:n.scrollHeight};return e&&t([n,e]),o}}();
46
+ var s=function(){"use strict";var t=function(t){var e=void 0===t?[]:t,r=e[0],o=e[1],n=Object.keys(o).sort(),a=n.reduce((function(t,e){return t[e]={value:r.style.getPropertyValue(e),important:Boolean(r.style.getPropertyPriority(e))},t}),{});return n.forEach((function(t){r.style.setProperty(t,"string"!=typeof o[t]&&o[t]?o[t].value:o[t],o[t]&&o[t].important?"important":"")})),a};return function(e){var r,o,n,a=(void 0===e?[]:e)[0];a!==document.documentElement&&a.tagName.toLowerCase()!==(o="HTML",(n=document.scrollingElement)&&(o=n.tagName),o.toLowerCase())||(r=t([a,{transform:"none"}]));var i={width:a.scrollWidth,height:a.scrollHeight};return r&&t([a,r]),i}}();
47
47
  return s(arg)
48
48
  }
49
49
  exports.getElementFixedAncestor=function(arg){
@@ -59,7 +59,7 @@ var s=function(){"use strict";return function(r){var n=void 0===r?[]:r,t=n[0],u=
59
59
  return s(arg)
60
60
  }
61
61
  exports.getElementRect=function(arg){
62
- var s=function(){"use strict";var t=function(t){for(var e=(void 0===t?[]:t)[0];e.offsetParent&&e.offsetParent!==document.body&&e.offsetParent!==document.documentElement;)e=e.offsetParent;return"fixed"===window.getComputedStyle(e).getPropertyValue("position")?e:null};var e=function(t){var e=(void 0===t?[]:t)[0];return e?{x:e.scrollLeft,y:e.scrollTop}:{x:window.scrollX||window.pageXOffset,y:window.scrollY||window.pageYOffset}};var r=function(t){var e=void 0===t?[]:t,r=e[0],o=e[1];return(void 0===o?[]:o).reduce((function(t,e){return t[e]={value:r.style.getPropertyValue(e),important:Boolean(r.style.getPropertyPriority(e))},t}),{})};var o=function(t){var e=(void 0===t?[]:t)[0],o=void 0===e?document.documentElement:e,n=r([o,["transform","-webkit-transform"]]),i=Object.keys(n).reduce((function(t,e){var r=n[e].value;if(r){var o=r.match(/^translate\s*\(\s*(\-?[\d, \.]+)px\s*(,\s*(-?[\d, \.]+)px)?\s*\)/);if(o){var i=o[1],a=void 0!==o[3]?o[3]:0;t.push({x:Math.round(-parseFloat(i)),y:Math.round(-parseFloat(a))})}else t.push({x:0,y:0})}return t}),[]);if(!i.every((function(t){return i[0].x===t.x||i[0].y===t.y})))throw new Error("Got different css positions!");return i[0]||{x:0,y:0}};var n=function(t){var r=(void 0===t?[]:t)[0],n=e([r]),i=o([r]);return{x:n.x+i.x,y:n.y+i.y}};return function(e){var r=void 0===e?[]:e,o=r[0],i=r[1],a=void 0!==i&&i;if(o===document.scrollingElement)return{x:0,y:0,width:o.clientWidth,height:o.clientHeight};var d=o.getBoundingClientRect(),u={x:d.left,y:d.top,width:d.width,height:d.height};if(a){var f=window.getComputedStyle(o);u.x+=parseInt(f.getPropertyValue("border-left-width")),u.y+=parseInt(f.getPropertyValue("border-top-width")),u.width=o.clientWidth,u.height=o.clientHeight}var l=t([o]);if(l){if(l!==o){var s=n([l]);u.x+=s.x,u.y+=s.y}}else{var v=n();u.x+=v.x,u.y+=v.y}return u}}();
62
+ var s=function(){"use strict";var t=function(t){for(var e=(void 0===t?[]:t)[0];e.offsetParent&&e.offsetParent!==document.body&&e.offsetParent!==document.documentElement;)e=e.offsetParent;return"fixed"===window.getComputedStyle(e).getPropertyValue("position")?e:null};var e=function(t){var e=(void 0===t?[]:t)[0];return e?{x:e.scrollLeft,y:e.scrollTop}:{x:window.scrollX||window.pageXOffset,y:window.scrollY||window.pageYOffset}};var r=function(t){var e=void 0===t?[]:t,r=e[0],o=e[1];return(void 0===o?[]:o).reduce((function(t,e){return t[e]={value:r.style.getPropertyValue(e),important:Boolean(r.style.getPropertyPriority(e))},t}),{})};var o=function(t){var e=(void 0===t?[]:t)[0],o=void 0===e?document.documentElement:e,n=r([o,["transform","-webkit-transform"]]),i=Object.keys(n).reduce((function(t,e){var r=n[e].value;if(r){var o=r.match(/^translate\s*\(\s*(\-?[\d, \.]+)px\s*(,\s*(-?[\d, \.]+)px)?\s*\)/);if(o){var i=o[1],a=void 0!==o[3]?o[3]:0;t.push({x:Math.round(-parseFloat(i)),y:Math.round(-parseFloat(a))})}else t.push({x:0,y:0})}return t}),[]);if(!i.every((function(t){return i[0].x===t.x||i[0].y===t.y})))throw new Error("Got different css positions!");return i[0]||{x:0,y:0}};var n=function(t){var r=(void 0===t?[]:t)[0],n=e([r]),i=o([r]);return{x:n.x+i.x,y:n.y+i.y}};return function(e){var r,o,i=void 0===e?[]:e,a=i[0],d=i[1],u=void 0!==d&&d;if(a===document.documentElement||a.tagName.toLowerCase()===(r="HTML",(o=document.scrollingElement)&&(r=o.tagName),r.toLowerCase()))return{x:0,y:0,width:a.clientWidth,height:a.clientHeight};var s=a.getBoundingClientRect(),l={x:s.left,y:s.top,width:s.width,height:s.height};if(u){var f=window.getComputedStyle(a);l.x+=parseInt(f.getPropertyValue("border-left-width")),l.y+=parseInt(f.getPropertyValue("border-top-width")),l.width=a.clientWidth,l.height=a.clientHeight}var c=t([a]);if(c){if(c!==a){var v=n([c]);l.x+=v.x,l.y+=v.y}}else{var y=n();l.x+=y.x,l.y+=y.y}return l}}();
63
63
  return s(arg)
64
64
  }
65
65
  exports.getElementScrollOffset=function(arg){
@@ -99,7 +99,7 @@ var s=function(){"use strict";return function(){var e=0,t=0;return window.innerH
99
99
  return s(arg)
100
100
  }
101
101
  exports.isElementScrollable=function(arg){
102
- var s=function(){"use strict";return function(t){var i=(void 0===t?[]:t)[0];return i.scrollWidth>i.clientWidth||i.scrollHeight>i.clientHeight}}();
102
+ var s=function(){"use strict";var t=function(t){var o=void 0===t?[]:t,r=o[0],e=o[1],i=void 0===e?[]:e,n=window.getComputedStyle(r);return n?i.map((function(t){return n.getPropertyValue(t)})):[]};return function(o){var r=(void 0===o?[]:o)[0],e=t([r,["overflow-x","overflow-y","overflow"]]);return("scroll"===e[0]||"auto"===e[0]||"hidden"===e[2])&&r.scrollWidth>r.clientWidth||("scroll"===e[1]||"auto"===e[1]||"hidden"===e[2])&&r.scrollHeight>r.clientHeight}}();
103
103
  return s(arg)
104
104
  }
105
105
  exports.isEqualElements=function(arg){
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@applitools/snippets",
3
- "version": "2.2.0",
3
+ "version": "2.2.3",
4
4
  "license": "SEE LICENSE IN LICENSE",
5
5
  "main": "./dist/index.js",
6
6
  "files": [
@@ -31,7 +31,7 @@
31
31
  },
32
32
  "dependencies": {},
33
33
  "devDependencies": {
34
- "@applitools/sdk-release-kit": "^0.3.3",
34
+ "@applitools/bongo": "^2.0.3",
35
35
  "@babel/core": "^7.11.6",
36
36
  "@babel/preset-env": "^7.11.5",
37
37
  "@rollup/plugin-babel": "^5.2.1",
package/CHANGELOG.md DELETED
@@ -1,120 +0,0 @@
1
-
2
- # Changelog
3
-
4
- ## Unreleased
5
-
6
-
7
- ## 2.2.0 - 2022/3/6
8
-
9
- - support assigning 'scrollingElement' as 'body' or 'html' dom element
10
-
11
- ## 2.1.15 - 2022/2/16
12
-
13
- - revert 2.1.14
14
-
15
- ## 2.1.14 - 2022/2/15
16
-
17
- - fix `getElementRect` for `document.scrollingElement`
18
-
19
- ## 2.1.13 - 2022/2/15
20
-
21
- - add `getViewportScale` snippet
22
- - remove auto scaling from `getViewportSize` and `addPageMarker`
23
- - marker mask and size have to be passed as arguments in `addPageMarker`
24
-
25
- ## 2.1.12 - 2021/12/22
26
-
27
- - round fractional values in `getViewportSize`
28
-
29
- ## 2.1.11 - 2021/12/22
30
-
31
- - add neutral color border around marker in `addPageMarker`
32
- - improve handling of pages without viewport tag in `addPageMarker` and `getViewportSize`
33
-
34
- ## 2.1.10 - 2021/12/20
35
-
36
- - overwrite `transform` style property with `!important` in `translateTo`
37
-
38
- ## 2.1.9 - 2021/12/17
39
-
40
- - fix `scrollTo` which was returning the wrong actual scroll position due to `scroll-behavior: smooth` style on the scrollable element
41
-
42
- ## 2.1.8 - 2021/12/16
43
-
44
- - fix `addPageMarker` to handle different pixel densities
45
- - change shape and size of marker added by `addPageMarker`
46
-
47
- ## 2.1.7 - 2021/9/9
48
-
49
- - fix `getShadowRoot` to follow convention for arguments
50
-
51
- ## 2.1.6 - 2021/9/6
52
-
53
- - return array instead of object from `addElementIds`
54
-
55
- ## 2.1.5 - 2021/9/6
56
-
57
- - add `getShadowRoot` snippet
58
- - replace `setElementMarkers` with `addElementIds` snippet, which will return a selector mapping
59
-
60
- ## 2.1.4 - 2021/8/4
61
-
62
- - add `isEqualElements` snippet
63
-
64
- ## 2.1.3 - 2021/3/11
65
-
66
- - fix exception thrown in getElementTranslateOffset [Trello](https://trello.com/c/duAwaupv)
67
-
68
- ## 2.1.1 - 2021/1/26
69
-
70
- - handle translated html elements during content size extracting
71
- - chore: add husky
72
-
73
- ## 2.1.0 - 2020/10/23
74
-
75
- - fix `blurElement`: use default value if element passed as `null`
76
- - fix `getElementRect`: extract element fixed ancestor inner offset even if it not scrollable
77
- - fix `setElementMarkers`: concat ids instead of override
78
-
79
- ## 2.0.3 - 2020/10/6
80
-
81
- - publish with dist folder
82
-
83
- ## 2.0.2 - 2020/10/6
84
-
85
- - added `addPageMarker` and `cleanupPageMarker` snippets
86
- - handle priority of the style properties in `getElementStyleProperties` and `setElementStyleProperties`
87
-
88
- ## 2.0.1 - 2020/9/28
89
-
90
- - remove yarn workspaces
91
-
92
- ## 2.0.0 - 2020/9/14
93
-
94
- - Breaking change: changed snippets argument format from object to array
95
- - Breaking change: changed snippets return value format from object to array
96
- - add ios tests
97
-
98
- ## 1.1.1 - 2020/8/30
99
-
100
- - nothing added, technical issue with unreleased commits
101
-
102
- ## 1.1.0 - 2020/8/30
103
-
104
- - add `markElements` and `cleanupElementIds`
105
-
106
- ## 1.0.3 - 2020/8/10
107
-
108
- - bumped sdk-release-kit version to latest
109
-
110
- ## 1.0.2 - 2020/8/4
111
-
112
- - Fix git tagging
113
-
114
- ## 1.0.1 - 2020/8/4
115
-
116
- - Fix IE capabilities
117
-
118
- ## 1.0.0 - 2020/8/4
119
-
120
- - First release