@applitools/snippets 2.1.12 → 2.1.13
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 +6 -0
- package/dist/commands.json +3 -2
- package/dist/index.js +6 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,12 @@
|
|
|
4
4
|
## Unreleased
|
|
5
5
|
|
|
6
6
|
|
|
7
|
+
## 2.1.13 - 2022/2/15
|
|
8
|
+
|
|
9
|
+
- add `getViewportScale` snippet
|
|
10
|
+
- remove auto scaling from `getViewportSize` and `addPageMarker`
|
|
11
|
+
- marker mask and size have to be passed as arguments in `addPageMarker`
|
|
12
|
+
|
|
7
13
|
## 2.1.12 - 2021/12/22
|
|
8
14
|
|
|
9
15
|
- round fractional values in `getViewportSize`
|
package/dist/commands.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"addElementIds": "function(arg){var s=function(){\"use strict\";return function(t){var o=t[0],e=t[1];return o.map((function(t,o){var r=[t];if(t.getRootNode)for(var a=t.getRootNode();a!==document;a=a.host.getRootNode())r.push(a.host);var n=e[o];return r.map((function(t){var o=t.getAttribute(\"data-applitools-selector\"),e=o?o+\" \"+n:n;return t.setAttribute(\"data-applitools-selector\",e),'[data-applitools-selector~=\"'+n+'\"]'}))}))}}();\nreturn s(arg)}",
|
|
3
|
-
"addPageMarker": "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(),i=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\":\"\")})),i};return function(){var e
|
|
3
|
+
"addPageMarker": "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(),i=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\":\"\")})),i};return function(e){var r=e[0],o=r.mask,n=r.size,i=void 0===n?1:n,a={1:\"rgb(0, 0, 0)\",0:\"rgb(255, 255, 255)\"},s=i,p=document.createElement(\"div\");p.setAttribute(\"data-applitools-marker\",\"\"),p.style.setProperty(\"position\",\"fixed\",\"important\"),p.style.setProperty(\"top\",\"0\",\"important\"),p.style.setProperty(\"left\",\"0\",\"important\"),p.style.setProperty(\"box-sizing\",\"content-box\",\"important\"),p.style.setProperty(\"padding\",s+\"px\",\"important\"),p.style.setProperty(\"background\",\"rgb(128, 128, 128)\",\"important\"),p.style.setProperty(\"z-index\",\"2147483647\",\"important\");for(var l,y=0;y<o.length;y+=l){for(l=1;o[y]===o[y+l];)++l;var m=o[y],d=document.createElement(\"div\");d.style.setProperty(\"display\",\"block\",\"important\"),d.style.setProperty(\"float\",\"left\",\"important\"),d.style.setProperty(\"width\",l*i+\"px\",\"important\"),d.style.setProperty(\"height\",i+\"px\",\"important\"),d.style.setProperty(\"background\",a[m],\"important\"),p.appendChild(d)}var u={value:\"none\",important:!0},c=t([document.documentElement,{transform:u,\"-webkit-transform\":u}]),f=t([document.body,{transform:u,\"-webkit-transform\":u}]);return document.documentElement.setAttribute(\"data-applitools-original-transforms\",JSON.stringify(c)),document.body.setAttribute(\"data-applitools-original-transforms\",JSON.stringify(f)),document.body.appendChild(p),{mask:o,size:i,offset:s}}}();\nreturn s(arg)}",
|
|
4
4
|
"blurElement": "function(arg){var s=function(){\"use strict\";return function(t){var n=(void 0===t?[]:t)[0]||document.activeElement;return n&&n.blur(),n}}();\nreturn s(arg)}",
|
|
5
5
|
"cleanupElementIds": "function(arg){var s=function(){\"use strict\";return function(t){t[0].forEach((function(t){if(t.removeAttribute(\"data-applitools-selector\"),t.getRootNode)for(var o=t.getRootNode();o!==document;o=o.host.getRootNode())o.host.removeAttribute(\"data-applitools-selector\")}))}}();\nreturn s(arg)}",
|
|
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)}",
|
|
@@ -21,7 +21,8 @@
|
|
|
21
21
|
"getPixelRatio": "function(arg){var s=function(){\"use strict\";return function(){return window.devicePixelRatio}}();\nreturn s(arg)}",
|
|
22
22
|
"getShadowRoot": "function(arg){var s=function(){\"use strict\";return function(t){return(void 0===t?[]:t)[0].shadowRoot}}();\nreturn s(arg)}",
|
|
23
23
|
"getUserAgent": "function(arg){var s=function(){\"use strict\";return function(){return window.navigator.userAgent}}();\nreturn s(arg)}",
|
|
24
|
-
"
|
|
24
|
+
"getViewportScale": "function(arg){var s=function(){\"use strict\";return function(){return window.visualViewport&&window.visualViewport.scale}}();\nreturn s(arg)}",
|
|
25
|
+
"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)}",
|
|
25
26
|
"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)}",
|
|
26
27
|
"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)}",
|
|
27
28
|
"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)}",
|
package/dist/index.js
CHANGED
|
@@ -3,7 +3,7 @@ var s=function(){"use strict";return function(t){var o=t[0],e=t[1];return o.map(
|
|
|
3
3
|
return s(arg)
|
|
4
4
|
}
|
|
5
5
|
exports.addPageMarker=function(arg){
|
|
6
|
-
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(),i=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":"")})),i};return function(){var e
|
|
6
|
+
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(),i=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":"")})),i};return function(e){var r=e[0],o=r.mask,n=r.size,i=void 0===n?1:n,a={1:"rgb(0, 0, 0)",0:"rgb(255, 255, 255)"},s=i,p=document.createElement("div");p.setAttribute("data-applitools-marker",""),p.style.setProperty("position","fixed","important"),p.style.setProperty("top","0","important"),p.style.setProperty("left","0","important"),p.style.setProperty("box-sizing","content-box","important"),p.style.setProperty("padding",s+"px","important"),p.style.setProperty("background","rgb(128, 128, 128)","important"),p.style.setProperty("z-index","2147483647","important");for(var l,y=0;y<o.length;y+=l){for(l=1;o[y]===o[y+l];)++l;var m=o[y],d=document.createElement("div");d.style.setProperty("display","block","important"),d.style.setProperty("float","left","important"),d.style.setProperty("width",l*i+"px","important"),d.style.setProperty("height",i+"px","important"),d.style.setProperty("background",a[m],"important"),p.appendChild(d)}var u={value:"none",important:!0},c=t([document.documentElement,{transform:u,"-webkit-transform":u}]),f=t([document.body,{transform:u,"-webkit-transform":u}]);return document.documentElement.setAttribute("data-applitools-original-transforms",JSON.stringify(c)),document.body.setAttribute("data-applitools-original-transforms",JSON.stringify(f)),document.body.appendChild(p),{mask:o,size:i,offset:s}}}();
|
|
7
7
|
return s(arg)
|
|
8
8
|
}
|
|
9
9
|
exports.blurElement=function(arg){
|
|
@@ -86,8 +86,12 @@ exports.getUserAgent=function(arg){
|
|
|
86
86
|
var s=function(){"use strict";return function(){return window.navigator.userAgent}}();
|
|
87
87
|
return s(arg)
|
|
88
88
|
}
|
|
89
|
+
exports.getViewportScale=function(arg){
|
|
90
|
+
var s=function(){"use strict";return function(){return window.visualViewport&&window.visualViewport.scale}}();
|
|
91
|
+
return s(arg)
|
|
92
|
+
}
|
|
89
93
|
exports.getViewportSize=function(arg){
|
|
90
|
-
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),
|
|
94
|
+
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}}}();
|
|
91
95
|
return s(arg)
|
|
92
96
|
}
|
|
93
97
|
exports.isElementScrollable=function(arg){
|