Socket
Socket
Sign inDemoInstall

opentok-layout-js

Package Overview
Dependencies
Maintainers
1
Versions
44
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

opentok-layout-js - npm Package Compare versions

Comparing version 3.7.1 to 3.7.2

2

bower.json
{
"name": "opentok-layout-js",
"version": "3.7.1",
"version": "3.7.2",
"homepage": "https://github.com/aullman/opentok-layout-js",

@@ -5,0 +5,0 @@ "authors": [

@@ -575,3 +575,3 @@ (function webpackUniversalModuleDefinition(root, factory) {

if (animate && $) {
if (animate && typeof $ !== 'undefined') {
$(elem).stop();

@@ -578,0 +578,0 @@ $(elem).animate(targetPosition, animate.duration || 200, animate.easing || 'swing', function () {

@@ -1,2 +0,2 @@

!function(t,i){"object"==typeof exports&&"object"==typeof module?module.exports=i():"function"==typeof define&&define.amd?define([],i):"object"==typeof exports?exports.initLayoutContainer=i():t.initLayoutContainer=i()}("undefined"!=typeof self?self:this,function(){return function(t){var i={};function e(o){if(i[o])return i[o].exports;var n=i[o]={i:o,l:!1,exports:{}};return t[o].call(n.exports,n,n.exports,e),n.l=!0,n.exports}return e.m=t,e.c=i,e.d=function(t,i,o){e.o(t,i)||Object.defineProperty(t,i,{enumerable:!0,get:o})},e.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},e.t=function(t,i){if(1&i&&(t=e(t)),8&i)return t;if(4&i&&"object"==typeof t&&t&&t.__esModule)return t;var o=Object.create(null);if(e.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:t}),2&i&&"string"!=typeof t)for(var n in t)e.d(o,n,function(i){return t[i]}.bind(null,n));return o},e.n=function(t){var i=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(i,"a",i),i},e.o=function(t,i){return Object.prototype.hasOwnProperty.call(t,i)},e.p="",e(e.s=2)}([function(t,i,e){"use strict";var o=function(t,i,e,o,n,r,a){for(var d=void 0,h=void 0,f=void 0,u=void 0,g=void 0,l=void 0,s=void 0,c=void 0,v=1;v<=n;v+=1){var m=v,p=Math.ceil(n/m);(c=(s=Math.floor(o/p))/(l=Math.floor(e/m)))>i?s=l*(c=i):c<t&&(l=s/(c=t));var x=(l=Math.min(r,l))*(s=Math.min(a,s))*n;(void 0===d||x>=d)&&(d=x,u=s,g=l,h=m,f=p)}return{maxArea:d,targetCols:h,targetRows:f,targetHeight:u,targetWidth:g,ratio:u/g}},n=function(t,i){var e=t.maxRatio,n=t.minRatio,r=t.fixedRatio,a=t.containerWidth,d=t.containerHeight,h=t.offsetLeft,f=void 0===h?0:h,u=t.offsetTop,g=void 0===u?0:u,l=t.alignItems,s=void 0===l?"center":l,c=t.maxWidth,v=void 0===c?1/0:c,m=t.maxHeight,p=void 0===m?1/0:m,x=i.map(function(t){return t.height/t.width}),b=x.length,y=void 0;if(r){var w=x.length>0?x[0]:null;y=o(w,w,a,d,b,v,p)}else y=o(n,e,a,d,b,v,p);for(var H=0,R=0,W=[],M=void 0,L=[],T=0;T<x.length;T+=1){T%y.targetCols==0&&(M={ratios:[],width:0,height:0},W.push(M));var S=x[T];M.ratios.push(S);var I=y.targetWidth,O=y.targetHeight;r&&(I=O/S),M.width+=I,M.height=O}for(var j=0,_=0,A=0;A<W.length;A+=1)(M=W[A]).width>a?(M.height=Math.floor(M.height*(a/M.width)),M.width=a):M.width<a&&M.height<p&&(_+=1),j+=M.height;if(j<d&&_>0){var C=d-j;j=0;for(var P=0;P<W.length;P+=1){if((M=W[P]).width<a){var k=C/_;k/M.height>(a-M.width)/M.width&&(k=Math.floor((a-M.width)/M.width*M.height)),M.width+=Math.floor(k/M.height*M.width),M.height+=k,C-=k,_-=1}j+=M.height}}switch(s){case"start":R=0;break;case"end":R=d-j;break;case"center":default:R=(d-j)/2}for(var E=0;E<W.length;E+=1){M=W[E];var q=void 0;switch(s){case"start":q=0;break;case"end":q=a-M.width;break;case"center":default:q=(a-M.width)/2}H=q;for(var B=void 0,N=0;N<M.ratios.length;N+=1){var F=M.ratios[N],$=y.targetWidth;B=M.height,r?$=Math.floor(B/F):B/$!=y.targetHeight/y.targetWidth&&($=Math.floor(y.targetWidth/y.targetHeight*B)),L.push({left:H+f,top:R+g,width:$,height:B}),H+=$}R+=B}return L};t.exports=function(t,i){var e=t.maxRatio,o=void 0===e?1.5:e,r=t.minRatio,a=void 0===r?9/16:r,d=t.fixedRatio,h=void 0!==d&&d,f=t.bigPercentage,u=void 0===f?.8:f,g=t.bigFixedRatio,l=void 0!==g&&g,s=t.bigMaxRatio,c=void 0===s?1.5:s,v=t.bigMinRatio,m=void 0===v?9/16:v,p=t.bigFirst,x=void 0===p||p,b=t.containerWidth,y=void 0===b?640:b,w=t.containerHeight,H=void 0===w?480:w,R=t.alignItems,W=void 0===R?"center":R,M=t.bigAlignItems,L=void 0===M?"center":M,T=t.smallAlignItems,S=void 0===T?"center":T,I=t.maxWidth,O=void 0===I?1/0:I,j=t.maxHeight,_=void 0===j?1/0:j,A=t.smallMaxWidth,C=void 0===A?1/0:A,P=t.smallMaxHeight,k=void 0===P?1/0:P,E=t.bigMaxWidth,q=void 0===E?1/0:E,B=t.bigMaxHeight,N=void 0===B?1/0:B,F=H/y,$=0,V=0,z=0,D=0,G=[],J=i.filter(function(t,i){return!!t.big&&(G.push(i),!0)}),K=i.filter(function(t){return!t.big}),Q=[],U=[];if(J.length>0&&K.length>0){var X=void 0,Y=void 0,Z=!0===x;F>function(t){return t.height/t.width}(J[0])?(X=y,z=H-(V=Y=Math.floor(H*u)),"column"===x?Z=!1:"row"===x&&(Z=!0)):(Y=H,D=y-($=X=Math.floor(y*u)),"column"===x?Z=!0:"row"===x&&(Z=!1)),Z?(Q=n({containerWidth:X,containerHeight:Y,offsetLeft:0,offsetTop:0,fixedRatio:l,minRatio:m,maxRatio:c,alignItems:L,maxWidth:q,maxHeight:N},J),U=n({containerWidth:y-$,containerHeight:H-V,offsetLeft:$,offsetTop:V,fixedRatio:h,minRatio:a,maxRatio:o,alignItems:S,maxWidth:C,maxHeight:k},K)):(U=n({containerWidth:y-$,containerHeight:H-V,offsetLeft:0,offsetTop:0,fixedRatio:h,minRatio:a,maxRatio:o,alignItems:S,maxWidth:C,maxHeight:k},K),Q=n({containerWidth:X,containerHeight:Y,offsetLeft:D,offsetTop:z,fixedRatio:l,minRatio:m,alignItems:L,maxWidth:q,maxHeight:N},J))}else J.length>0&&0===K.length?Q=n({containerWidth:y,containerHeight:H,fixedRatio:l,minRatio:m,maxRatio:c,alignItems:L,maxWidth:q,maxHeight:N},J):U=n({containerWidth:y-$,containerHeight:H-V,offsetLeft:$,offsetTop:V,fixedRatio:h,minRatio:a,maxRatio:o,alignItems:W,maxWidth:O,maxHeight:_},K);var tt=[],it=0,et=0;return i.forEach(function(t,i){G.indexOf(i)>-1?(tt[i]=Q[it],it+=1):(tt[i]=U[et],et+=1)}),tt}},function(t,i,e){"use strict";var o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},n=e(0);t.exports=function(t,i){function e(t,n,r){if(r)return t.style[n]=r,NaN;if("object"===(void 0===n?"undefined":o(n)))return Object.keys(n).forEach(function(i){e(t,i,n[i])}),NaN;var a=(i&&i.window||window).getComputedStyle(t).getPropertyValue(n);return""===a&&(a=t.style[n]),a}var r=function(t,i){var o=e(t,i);return o?parseInt(o,10):0},a=i.animate,d=void 0!==a&&a,h=i.bigClass,f=void 0===h?"OT_big":h,u=i.ignoreClass,g=void 0===u?"OT_ignore":u;if("none"!==e(t,"display")){var l=t.getAttribute("id");l||(l="OT_"+(1e8*Math.random()).toFixed(0),t.setAttribute("id",l)),i.containerHeight=function(t){var i=function(t){return t.offsetHeight>0?t.offsetHeight+"px":e(t,"height")}(t);return i?parseInt(i,10):0}(t)-r(t,"borderTop")-r(t,"borderBottom"),i.containerWidth=function(t){var i=function(t){return t.offsetWidth>0?t.offsetWidth+"px":e(t,"width")}(t);return i?parseInt(i,10):0}(t)-r(t,"borderLeft")-r(t,"borderRight");var s=Array.prototype.filter.call(t.querySelectorAll("#"+l+">*:not(."+g+")"),function(t){return"none"!==e(t,"display")}),c=s.map(function(t){var i=function(t){if(t){if(t.videoHeight&&t.videoWidth)return{height:t.videoHeight,width:t.videoWidth};var i=t.querySelector("video");if(i&&i.videoHeight&&i.videoWidth)return{height:i.videoHeight,width:i.videoWidth}}return{height:480,width:640}}(t);return i.big=t.classList.contains(f),i});n(i,c).forEach(function(t,i){var o=s[i];e(o,"position","absolute");var n=t.width-r(o,"paddingLeft")-r(o,"paddingRight")-r(o,"marginLeft")-r(o,"marginRight")-r(o,"borderLeft")-r(o,"borderRight"),a=t.height-r(o,"paddingTop")-r(o,"paddingBottom")-r(o,"marginTop")-r(o,"marginBottom")-r(o,"borderTop")-r(o,"borderBottom");!function(t,i,o,n,r,a){var d=this,h={left:i+"px",top:o+"px",width:n+"px",height:r+"px"},f=function(){var i=t.querySelector(".OT_root");if(i){var e=i.style.width;i.style.width=n+"px",i.style.width=e||""}};a&&$?($(t).stop(),$(t).animate(h,a.duration||200,a.easing||"swing",function(){f(),a.complete&&a.complete.call(d)})):(e(t,h),t.classList.contains("ot-layout")||t.classList.add("ot-layout")),f()}(o,t.left,t.top,n,a,d)})}}},function(t,i,e){"use strict";
!function(t,i){"object"==typeof exports&&"object"==typeof module?module.exports=i():"function"==typeof define&&define.amd?define([],i):"object"==typeof exports?exports.initLayoutContainer=i():t.initLayoutContainer=i()}("undefined"!=typeof self?self:this,function(){return function(t){var i={};function e(o){if(i[o])return i[o].exports;var n=i[o]={i:o,l:!1,exports:{}};return t[o].call(n.exports,n,n.exports,e),n.l=!0,n.exports}return e.m=t,e.c=i,e.d=function(t,i,o){e.o(t,i)||Object.defineProperty(t,i,{enumerable:!0,get:o})},e.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},e.t=function(t,i){if(1&i&&(t=e(t)),8&i)return t;if(4&i&&"object"==typeof t&&t&&t.__esModule)return t;var o=Object.create(null);if(e.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:t}),2&i&&"string"!=typeof t)for(var n in t)e.d(o,n,function(i){return t[i]}.bind(null,n));return o},e.n=function(t){var i=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(i,"a",i),i},e.o=function(t,i){return Object.prototype.hasOwnProperty.call(t,i)},e.p="",e(e.s=2)}([function(t,i,e){"use strict";var o=function(t,i,e,o,n,r,a){for(var d=void 0,f=void 0,h=void 0,u=void 0,g=void 0,l=void 0,s=void 0,c=void 0,v=1;v<=n;v+=1){var m=v,p=Math.ceil(n/m);(c=(s=Math.floor(o/p))/(l=Math.floor(e/m)))>i?s=l*(c=i):c<t&&(l=s/(c=t));var x=(l=Math.min(r,l))*(s=Math.min(a,s))*n;(void 0===d||x>=d)&&(d=x,u=s,g=l,f=m,h=p)}return{maxArea:d,targetCols:f,targetRows:h,targetHeight:u,targetWidth:g,ratio:u/g}},n=function(t,i){var e=t.maxRatio,n=t.minRatio,r=t.fixedRatio,a=t.containerWidth,d=t.containerHeight,f=t.offsetLeft,h=void 0===f?0:f,u=t.offsetTop,g=void 0===u?0:u,l=t.alignItems,s=void 0===l?"center":l,c=t.maxWidth,v=void 0===c?1/0:c,m=t.maxHeight,p=void 0===m?1/0:m,x=i.map(function(t){return t.height/t.width}),b=x.length,y=void 0;if(r){var w=x.length>0?x[0]:null;y=o(w,w,a,d,b,v,p)}else y=o(n,e,a,d,b,v,p);for(var H=0,R=0,W=[],M=void 0,L=[],T=0;T<x.length;T+=1){T%y.targetCols==0&&(M={ratios:[],width:0,height:0},W.push(M));var S=x[T];M.ratios.push(S);var I=y.targetWidth,O=y.targetHeight;r&&(I=O/S),M.width+=I,M.height=O}for(var j=0,_=0,A=0;A<W.length;A+=1)(M=W[A]).width>a?(M.height=Math.floor(M.height*(a/M.width)),M.width=a):M.width<a&&M.height<p&&(_+=1),j+=M.height;if(j<d&&_>0){var C=d-j;j=0;for(var P=0;P<W.length;P+=1){if((M=W[P]).width<a){var k=C/_;k/M.height>(a-M.width)/M.width&&(k=Math.floor((a-M.width)/M.width*M.height)),M.width+=Math.floor(k/M.height*M.width),M.height+=k,C-=k,_-=1}j+=M.height}}switch(s){case"start":R=0;break;case"end":R=d-j;break;case"center":default:R=(d-j)/2}for(var E=0;E<W.length;E+=1){M=W[E];var q=void 0;switch(s){case"start":q=0;break;case"end":q=a-M.width;break;case"center":default:q=(a-M.width)/2}H=q;for(var B=void 0,N=0;N<M.ratios.length;N+=1){var F=M.ratios[N],$=y.targetWidth;B=M.height,r?$=Math.floor(B/F):B/$!=y.targetHeight/y.targetWidth&&($=Math.floor(y.targetWidth/y.targetHeight*B)),L.push({left:H+h,top:R+g,width:$,height:B}),H+=$}R+=B}return L};t.exports=function(t,i){var e=t.maxRatio,o=void 0===e?1.5:e,r=t.minRatio,a=void 0===r?9/16:r,d=t.fixedRatio,f=void 0!==d&&d,h=t.bigPercentage,u=void 0===h?.8:h,g=t.bigFixedRatio,l=void 0!==g&&g,s=t.bigMaxRatio,c=void 0===s?1.5:s,v=t.bigMinRatio,m=void 0===v?9/16:v,p=t.bigFirst,x=void 0===p||p,b=t.containerWidth,y=void 0===b?640:b,w=t.containerHeight,H=void 0===w?480:w,R=t.alignItems,W=void 0===R?"center":R,M=t.bigAlignItems,L=void 0===M?"center":M,T=t.smallAlignItems,S=void 0===T?"center":T,I=t.maxWidth,O=void 0===I?1/0:I,j=t.maxHeight,_=void 0===j?1/0:j,A=t.smallMaxWidth,C=void 0===A?1/0:A,P=t.smallMaxHeight,k=void 0===P?1/0:P,E=t.bigMaxWidth,q=void 0===E?1/0:E,B=t.bigMaxHeight,N=void 0===B?1/0:B,F=H/y,$=0,V=0,z=0,D=0,G=[],J=i.filter(function(t,i){return!!t.big&&(G.push(i),!0)}),K=i.filter(function(t){return!t.big}),Q=[],U=[];if(J.length>0&&K.length>0){var X=void 0,Y=void 0,Z=!0===x;F>function(t){return t.height/t.width}(J[0])?(X=y,z=H-(V=Y=Math.floor(H*u)),"column"===x?Z=!1:"row"===x&&(Z=!0)):(Y=H,D=y-($=X=Math.floor(y*u)),"column"===x?Z=!0:"row"===x&&(Z=!1)),Z?(Q=n({containerWidth:X,containerHeight:Y,offsetLeft:0,offsetTop:0,fixedRatio:l,minRatio:m,maxRatio:c,alignItems:L,maxWidth:q,maxHeight:N},J),U=n({containerWidth:y-$,containerHeight:H-V,offsetLeft:$,offsetTop:V,fixedRatio:f,minRatio:a,maxRatio:o,alignItems:S,maxWidth:C,maxHeight:k},K)):(U=n({containerWidth:y-$,containerHeight:H-V,offsetLeft:0,offsetTop:0,fixedRatio:f,minRatio:a,maxRatio:o,alignItems:S,maxWidth:C,maxHeight:k},K),Q=n({containerWidth:X,containerHeight:Y,offsetLeft:D,offsetTop:z,fixedRatio:l,minRatio:m,alignItems:L,maxWidth:q,maxHeight:N},J))}else J.length>0&&0===K.length?Q=n({containerWidth:y,containerHeight:H,fixedRatio:l,minRatio:m,maxRatio:c,alignItems:L,maxWidth:q,maxHeight:N},J):U=n({containerWidth:y-$,containerHeight:H-V,offsetLeft:$,offsetTop:V,fixedRatio:f,minRatio:a,maxRatio:o,alignItems:W,maxWidth:O,maxHeight:_},K);var tt=[],it=0,et=0;return i.forEach(function(t,i){G.indexOf(i)>-1?(tt[i]=Q[it],it+=1):(tt[i]=U[et],et+=1)}),tt}},function(t,i,e){"use strict";var o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},n=e(0);t.exports=function(t,i){function e(t,n,r){if(r)return t.style[n]=r,NaN;if("object"===(void 0===n?"undefined":o(n)))return Object.keys(n).forEach(function(i){e(t,i,n[i])}),NaN;var a=(i&&i.window||window).getComputedStyle(t).getPropertyValue(n);return""===a&&(a=t.style[n]),a}var r=function(t,i){var o=e(t,i);return o?parseInt(o,10):0},a=i.animate,d=void 0!==a&&a,f=i.bigClass,h=void 0===f?"OT_big":f,u=i.ignoreClass,g=void 0===u?"OT_ignore":u;if("none"!==e(t,"display")){var l=t.getAttribute("id");l||(l="OT_"+(1e8*Math.random()).toFixed(0),t.setAttribute("id",l)),i.containerHeight=function(t){var i=function(t){return t.offsetHeight>0?t.offsetHeight+"px":e(t,"height")}(t);return i?parseInt(i,10):0}(t)-r(t,"borderTop")-r(t,"borderBottom"),i.containerWidth=function(t){var i=function(t){return t.offsetWidth>0?t.offsetWidth+"px":e(t,"width")}(t);return i?parseInt(i,10):0}(t)-r(t,"borderLeft")-r(t,"borderRight");var s=Array.prototype.filter.call(t.querySelectorAll("#"+l+">*:not(."+g+")"),function(t){return"none"!==e(t,"display")}),c=s.map(function(t){var i=function(t){if(t){if(t.videoHeight&&t.videoWidth)return{height:t.videoHeight,width:t.videoWidth};var i=t.querySelector("video");if(i&&i.videoHeight&&i.videoWidth)return{height:i.videoHeight,width:i.videoWidth}}return{height:480,width:640}}(t);return i.big=t.classList.contains(h),i});n(i,c).forEach(function(t,i){var o=s[i];e(o,"position","absolute");var n=t.width-r(o,"paddingLeft")-r(o,"paddingRight")-r(o,"marginLeft")-r(o,"marginRight")-r(o,"borderLeft")-r(o,"borderRight"),a=t.height-r(o,"paddingTop")-r(o,"paddingBottom")-r(o,"marginTop")-r(o,"marginBottom")-r(o,"borderTop")-r(o,"borderBottom");!function(t,i,o,n,r,a){var d=this,f={left:i+"px",top:o+"px",width:n+"px",height:r+"px"},h=function(){var i=t.querySelector(".OT_root");if(i){var e=i.style.width;i.style.width=n+"px",i.style.width=e||""}};a&&"undefined"!=typeof $?($(t).stop(),$(t).animate(f,a.duration||200,a.easing||"swing",function(){h(),a.complete&&a.complete.call(d)})):(e(t,f),t.classList.contains("ot-layout")||t.classList.add("ot-layout")),h()}(o,t.left,t.top,n,a,d)})}}},function(t,i,e){"use strict";
/*!

@@ -3,0 +3,0 @@ * opentok-layout-js (http://github.com/aullman/opentok-layout-js)

{
"name": "opentok-layout-js",
"version": "3.7.1",
"version": "3.7.2",
"description": "Automatic layout of video elements (publisher and subscriber) minimising white-space for the OpenTok on WebRTC API. This is intended for use with the OpenTok on WebRTC JS API.",

@@ -5,0 +5,0 @@ "main": "opentok-layout.js",

@@ -51,3 +51,3 @@ [![Build Status](https://travis-ci.org/aullman/opentok-layout-js.svg?branch=master)](https://travis-ci.org/aullman/opentok-layout-js)

// You can also pass 'column' or 'row' to change whether big is first when you are in a row (bottom) or a column (right) layout
animate: true // Whether you want to animate the transitions
animate: true // Whether you want to animate the transitions using jQuery (not recommended, use CSS transitions instead)
window: window, // Lets you pass in your own window object which should be the same window that the element is in

@@ -54,0 +54,0 @@ ignoreClass: 'OT_ignore', // Elements with this class will be ignored and not positioned. This lets you do things like picture-in-picture

@@ -65,3 +65,3 @@ const getLayout = require('./getLayout');

if (animate && $) {
if (animate && typeof $ !== 'undefined') {
$(elem).stop();

@@ -68,0 +68,0 @@ $(elem).animate(targetPosition, animate.duration || 200, animate.easing || 'swing',

@@ -82,3 +82,3 @@ /* globals describe, beforeEach, expect, it, afterEach, initLayoutContainer */

['width', 'height', 'left', 'top'].forEach((val) => {
expect(boundingRect[val]).toEqual(expectedLayout[idx][val]);
expect(boundingRect[val]).toBeCloseTo(expectedLayout[idx][val], 1);
});

@@ -120,4 +120,4 @@ });

const div2Rect = div2.getBoundingClientRect();
expect(div1Rect.height).toBe(300);
expect(div2Rect.height).toBe(300);
expect(div1Rect.height).toBeCloseTo(300, 1);
expect(div2Rect.height).toBeCloseTo(300, 1);
expect(div2Rect.width).not.toBeGreaterThan(640);

@@ -162,7 +162,7 @@ });

case 'end':
expect(boundingRect.left).toEqual(160);
expect(boundingRect.left).toBeCloseTo(160, 1);
break;
case 'center':
default:
expect(boundingRect.left).toEqual(80);
expect(boundingRect.left).toBeCloseTo(80, 1);
break;

@@ -182,11 +182,11 @@ }

const div1Rect = div1.getBoundingClientRect();
expect(div1Rect.width).toEqual(160);
expect(div1Rect.height).toEqual(100);
expect(div1Rect.left).toEqual(40);
expect(div1Rect.top).toEqual(100);
expect(div1Rect.width).toBeCloseTo(160, 1);
expect(div1Rect.height).toBeCloseTo(100, 1);
expect(div1Rect.left).toBeCloseTo(40, 1);
expect(div1Rect.top).toBeCloseTo(100, 1);
const div2Rect = div2.getBoundingClientRect();
expect(div2Rect.width).toEqual(160);
expect(div2Rect.height).toEqual(100);
expect(div2Rect.left).toEqual(200);
expect(div2Rect.top).toEqual(100);
expect(div2Rect.width).toBeCloseTo(160, 1);
expect(div2Rect.height).toBeCloseTo(100, 1);
expect(div2Rect.left).toBeCloseTo(200, 1);
expect(div2Rect.top).toBeCloseTo(100, 1);
});

@@ -207,11 +207,11 @@ });

const div1Rect = div1.getBoundingClientRect();
expect(div1Rect.width).toBe(100);
expect(div1Rect.height).toBe(100);
expect(div1Rect.top).toBe(0);
expect(div1Rect.left).toBe(0);
expect(div1Rect.width).toBeCloseTo(100, 1);
expect(div1Rect.height).toBeCloseTo(100, 1);
expect(div1Rect.top).toBeCloseTo(0, 1);
expect(div1Rect.left).toBeCloseTo(0, 1);
const div2Rect = div2.getBoundingClientRect();
expect(div2Rect.width).toBe(400);
expect(div2Rect.height).toBe(300);
expect(div2Rect.top).toBe(0);
expect(div2Rect.left).toBe(0);
expect(div2Rect.width).toBeCloseTo(400, 1);
expect(div2Rect.height).toBeCloseTo(300, 1);
expect(div2Rect.top).toBeCloseTo(0, 1);
expect(div2Rect.left).toBeCloseTo(0, 1);
});

@@ -256,3 +256,3 @@ });

['width', 'height', 'left', 'top'].forEach((val) => {
expect(boundingRect[val]).toEqual(expectedLayout[idx][val]);
expect(boundingRect[val]).toBeCloseTo(expectedLayout[idx][val], 1);
});

@@ -282,6 +282,6 @@ });

const div2Rect = div2.getBoundingClientRect();
expect(div1Rect.width).toBe(360);
expect(div2Rect.width).toBe(40);
expect(div1Rect.height).toBe(300);
expect(div2Rect.height).toBe(60);
expect(div1Rect.width).toBeCloseTo(360, 1);
expect(div2Rect.width).toBeCloseTo(40, 1);
expect(div1Rect.height).toBeCloseTo(300, 1);
expect(div2Rect.height).toBeCloseTo(60, 1);
});

@@ -293,4 +293,4 @@

const div1Rect = div1.getBoundingClientRect();
expect(div1Rect.left).toBe(80);
expect(div1Rect.top).toBe(0);
expect(div1Rect.left).toBeCloseTo(80, 1);
expect(div1Rect.top).toBeCloseTo(0, 1);
});

@@ -306,6 +306,6 @@

const div2Rect = div2.getBoundingClientRect();
expect(div1Rect.width).toBe(310);
expect(div2Rect.width).toBe(70);
expect(div1Rect.height).toBe(290);
expect(div2Rect.height).toBe(110);
expect(div1Rect.width).toBeCloseTo(310, 1);
expect(div2Rect.width).toBeCloseTo(70, 1);
expect(div1Rect.height).toBeCloseTo(290, 1);
expect(div2Rect.height).toBeCloseTo(110, 1);
});

@@ -319,6 +319,6 @@

layoutContainer.layout();
expect(div1.clientWidth).toBe(320);
expect(div2.clientWidth).toBe(80);
expect(div1.clientHeight).toBe(300);
expect(div2.clientHeight).toBe(120);
expect(div1.clientWidth).toBeCloseTo(320, 1);
expect(div2.clientWidth).toBeCloseTo(80, -1);
expect(div1.clientHeight).toBeCloseTo(300, 1);
expect(div2.clientHeight).toBeCloseTo(120, 1);
});

@@ -334,10 +334,10 @@

case 'start':
expect(boundingRect.top).toEqual(0);
expect(boundingRect.top).toBeCloseTo(0, 1);
break;
case 'end':
expect(boundingRect.top).toEqual(180);
expect(boundingRect.top).toBeCloseTo(180, 1);
break;
case 'center':
default:
expect(boundingRect.top).toEqual(90);
expect(boundingRect.top).toBeCloseTo(90, 1);
break;

@@ -360,10 +360,10 @@ }

case 'start':
expect(boundingRect.top).toEqual(0);
expect(boundingRect.top).toBeCloseTo(0, 1);
break;
case 'end':
expect(boundingRect.top).toEqual(60);
expect(boundingRect.top).toBeCloseTo(60, 1);
break;
case 'center':
default:
expect(boundingRect.top).toEqual(30);
expect(boundingRect.top).toBeCloseTo(30, 1);
break;

@@ -383,11 +383,11 @@ }

const div1Rect = div1.getBoundingClientRect();
expect(div1Rect.width).toEqual(200);
expect(div1Rect.height).toEqual(220);
expect(div1Rect.left).toEqual(60);
expect(div1Rect.top).toEqual(40);
expect(div1Rect.width).toBeCloseTo(200, 1);
expect(div1Rect.height).toBeCloseTo(220, 1);
expect(div1Rect.left).toBeCloseTo(60, 1);
expect(div1Rect.top).toBeCloseTo(40, 1);
const div2Rect = div2.getBoundingClientRect();
expect(div2Rect.width).toEqual(80);
expect(div2Rect.height).toEqual(120);
expect(div2Rect.left).toEqual(320);
expect(div2Rect.top).toEqual(90);
expect(div2Rect.width).toBeCloseTo(80, 1);
expect(div2Rect.height).toBeCloseTo(120, 1);
expect(div2Rect.left).toBeCloseTo(320, 1);
expect(div2Rect.top).toBeCloseTo(90, 1);
});

@@ -402,11 +402,11 @@

const div1Rect = div1.getBoundingClientRect();
expect(div1Rect.width).toEqual(320);
expect(div1Rect.height).toEqual(300);
expect(div1Rect.left).toEqual(0);
expect(div1Rect.top).toEqual(0);
expect(div1Rect.width).toBeCloseTo(320, 1);
expect(div1Rect.height).toBeCloseTo(300, 1);
expect(div1Rect.left).toBeCloseTo(0, 1);
expect(div1Rect.top).toBeCloseTo(0, 1);
const div2Rect = div2.getBoundingClientRect();
expect(div2Rect.width).toEqual(50);
expect(div2Rect.height).toEqual(50);
expect(div2Rect.left).toEqual(335);
expect(div2Rect.top).toEqual(125);
expect(div2Rect.width).toBeCloseTo(50, 1);
expect(div2Rect.height).toBeCloseTo(50, 1);
expect(div2Rect.left).toBeCloseTo(335, 1);
expect(div2Rect.top).toBeCloseTo(125, 1);
});

@@ -454,20 +454,20 @@ });

rect = divs[i].getBoundingClientRect();
expect(rect.width).toBe(133);
expect(rect.height).toBe(150);
expect(rect.width).toBeCloseTo(133, 1);
expect(rect.height).toBeCloseTo(150, 1);
}
rect = divs[0].getBoundingClientRect();
expect(rect.left).toBe(0.5);
expect(rect.top).toBe(0);
expect(rect.left).toBeCloseTo(0.5, 1);
expect(rect.top).toBeCloseTo(0, 1);
rect = divs[1].getBoundingClientRect();
expect(rect.left).toBe(133.5);
expect(rect.top).toBe(0);
expect(rect.left).toBeCloseTo(133.5, 1);
expect(rect.top).toBeCloseTo(0, 1);
rect = divs[2].getBoundingClientRect();
expect(rect.left).toBe(266.5);
expect(rect.top).toBe(0);
expect(rect.left).toBeCloseTo(266.5, 1);
expect(rect.top).toBeCloseTo(0, 1);
rect = divs[3].getBoundingClientRect();
expect(rect.left).toBe(67);
expect(rect.top).toBe(150);
expect(rect.left).toBeCloseTo(67, 1);
expect(rect.top).toBeCloseTo(150, 1);
rect = divs[4].getBoundingClientRect();
expect(rect.left).toBe(200);
expect(rect.top).toBe(150);
expect(rect.left).toBeCloseTo(200, 1);
expect(rect.top).toBeCloseTo(150, 1);
});

@@ -485,3 +485,3 @@

const rect = divs[4].getBoundingClientRect();
expect(rect.top + rect.height).toBe(600);
expect(rect.top + rect.height).toBeCloseTo(600, 1);
});

@@ -507,6 +507,6 @@

const bigRect = divs[0].getBoundingClientRect();
expect(bigRect.width).toBe(320);
expect(bigRect.height).toBe(300);
expect(bigRect.left).toBe(0);
expect(bigRect.top).toBe(0);
expect(bigRect.width).toBeCloseTo(320, 1);
expect(bigRect.height).toBeCloseTo(300, 1);
expect(bigRect.left).toBeCloseTo(0, 1);
expect(bigRect.top).toBeCloseTo(0, 1);
// Expect them to all have the same width and height

@@ -516,17 +516,17 @@ let rect;

rect = divs[i].getBoundingClientRect();
expect(rect.width).toBe(80);
expect(rect.height).toBe(75);
expect(rect.width).toBeCloseTo(80, 1);
expect(rect.height).toBeCloseTo(75, 1);
}
rect = divs[1].getBoundingClientRect();
expect(rect.left).toBe(320);
expect(rect.top).toBe(0);
expect(rect.left).toBeCloseTo(320, 1);
expect(rect.top).toBeCloseTo(0, 1);
rect = divs[2].getBoundingClientRect();
expect(rect.left).toBe(320);
expect(rect.top).toBe(75);
expect(rect.left).toBeCloseTo(320, 1);
expect(rect.top).toBeCloseTo(75, 1);
rect = divs[3].getBoundingClientRect();
expect(rect.left).toBe(320);
expect(rect.top).toBe(150);
expect(rect.left).toBeCloseTo(320, 1);
expect(rect.top).toBeCloseTo(150, 1);
rect = divs[4].getBoundingClientRect();
expect(rect.left).toBe(320);
expect(rect.top).toBe(225);
expect(rect.left).toBeCloseTo(320, 1);
expect(rect.top).toBeCloseTo(225, 1);
});

@@ -542,11 +542,11 @@

expect(bigRect.width).toBeCloseTo(266.66, 1);
expect(bigRect.height).toBe(150);
expect(bigRect.height).toBeCloseTo(150, 1);
expect(bigRect.left).toBeCloseTo(26.66, 1);
expect(bigRect.top).toBe(0);
expect(bigRect.top).toBeCloseTo(0, 1);
// Expect div[1] to be big
const big2Rect = divs[1].getBoundingClientRect();
expect(big2Rect.width).toBeCloseTo(266.66, 1);
expect(big2Rect.height).toBe(150);
expect(big2Rect.height).toBeCloseTo(150, 1);
expect(big2Rect.left).toBeCloseTo(26.66, 1);
expect(big2Rect.top).toBe(150);
expect(big2Rect.top).toBeCloseTo(150, 1);
// Expect them to all have the same width and height

@@ -556,14 +556,14 @@ let rect;

rect = divs[i].getBoundingClientRect();
expect(rect.width).toBe(80);
expect(rect.height).toBe(100);
expect(rect.width).toBeCloseTo(80, 1);
expect(rect.height).toBeCloseTo(100, 1);
}
rect = divs[2].getBoundingClientRect();
expect(rect.left).toBe(320);
expect(rect.top).toBe(0);
expect(rect.left).toBeCloseTo(320, 1);
expect(rect.top).toBeCloseTo(0, 1);
rect = divs[3].getBoundingClientRect();
expect(rect.left).toBe(320);
expect(rect.top).toBe(100);
expect(rect.left).toBeCloseTo(320, 1);
expect(rect.top).toBeCloseTo(100, 1);
rect = divs[4].getBoundingClientRect();
expect(rect.left).toBe(320);
expect(rect.top).toBe(200);
expect(rect.left).toBeCloseTo(320, 1);
expect(rect.top).toBeCloseTo(200, 1);
});

@@ -577,4 +577,4 @@

const rect = divs[i].getBoundingClientRect();
expect(rect.width).toBe(200);
expect(rect.height).toBe(150);
expect(rect.width).toBeCloseTo(200, 1);
expect(rect.height).toBeCloseTo(150, 1);
}

@@ -595,20 +595,20 @@ });

rect = divs[i].getBoundingClientRect();
expect(rect.width).toBe(200);
expect(rect.height).toBe(300);
expect(rect.width).toBeCloseTo(200, 1);
expect(rect.height).toBeCloseTo(300, 1);
}
rect = divs[0].getBoundingClientRect();
expect(rect.left).toBe(0);
expect(rect.top).toBe(0);
expect(rect.left).toBeCloseTo(0, 1);
expect(rect.top).toBeCloseTo(0, 1);
rect = divs[1].getBoundingClientRect();
expect(rect.left).toBe(200);
expect(rect.top).toBe(0);
expect(rect.left).toBeCloseTo(200, 1);
expect(rect.top).toBeCloseTo(0, 1);
rect = divs[2].getBoundingClientRect();
expect(rect.left).toBe(400);
expect(rect.top).toBe(0);
expect(rect.left).toBeCloseTo(400, 1);
expect(rect.top).toBeCloseTo(0, 1);
rect = divs[3].getBoundingClientRect();
expect(rect.left).toBe(600);
expect(rect.top).toBe(0);
expect(rect.left).toBeCloseTo(600, 1);
expect(rect.top).toBeCloseTo(0, 1);
rect = divs[4].getBoundingClientRect();
expect(rect.left).toBe(800);
expect(rect.top).toBe(0);
expect(rect.left).toBeCloseTo(800, 1);
expect(rect.top).toBeCloseTo(0, 1);
});

@@ -623,5 +623,5 @@

expect(bigRect.width).toBeCloseTo(533.33, 1);
expect(bigRect.height).toBe(300);
expect(bigRect.height).toBeCloseTo(300, 1);
expect(bigRect.left).toBeCloseTo(133.33, 1);
expect(bigRect.top).toBe(0);
expect(bigRect.top).toBeCloseTo(0, 1);
// Expect them to all have the same width and height

@@ -631,17 +631,17 @@ let rect;

rect = divs[i].getBoundingClientRect();
expect(rect.width).toBe(100);
expect(rect.height).toBe(150);
expect(rect.width).toBeCloseTo(100, 1);
expect(rect.height).toBeCloseTo(150, 1);
}
rect = divs[1].getBoundingClientRect();
expect(rect.left).toBe(800);
expect(rect.top).toBe(0);
expect(rect.left).toBeCloseTo(800, 1);
expect(rect.top).toBeCloseTo(0, 1);
rect = divs[2].getBoundingClientRect();
expect(rect.left).toBe(900);
expect(rect.top).toBe(0);
expect(rect.left).toBeCloseTo(900, 1);
expect(rect.top).toBeCloseTo(0, 1);
rect = divs[3].getBoundingClientRect();
expect(rect.left).toBe(800);
expect(rect.top).toBe(150);
expect(rect.left).toBeCloseTo(800, 1);
expect(rect.top).toBeCloseTo(150, 1);
rect = divs[4].getBoundingClientRect();
expect(rect.left).toBe(900);
expect(rect.top).toBe(150);
expect(rect.left).toBeCloseTo(900, 1);
expect(rect.top).toBeCloseTo(150, 1);
});

@@ -673,12 +673,12 @@

const bigRect = divs[0].getBoundingClientRect();
expect(bigRect.width).toBe(400);
expect(bigRect.height).toBe(300);
expect(bigRect.left).toBe(0);
expect(bigRect.top).toBe(0);
expect(bigRect.width).toBeCloseTo(400, 1);
expect(bigRect.height).toBeCloseTo(300, 1);
expect(bigRect.left).toBeCloseTo(0, 1);
expect(bigRect.top).toBeCloseTo(0, 1);
// Expect div[1] to be big
const big2Rect = divs[1].getBoundingClientRect();
expect(big2Rect.width).toBe(400);
expect(big2Rect.height).toBe(300);
expect(big2Rect.left).toBe(400);
expect(big2Rect.top).toBe(0);
expect(big2Rect.width).toBeCloseTo(400, 1);
expect(big2Rect.height).toBeCloseTo(300, 1);
expect(big2Rect.left).toBeCloseTo(400, 1);
expect(big2Rect.top).toBeCloseTo(0, 1);
// Expect them to all have the same width and height

@@ -689,13 +689,13 @@ let rect;

expect(rect.width).toBeCloseTo(177.76, 1);
expect(rect.height).toBe(100);
expect(rect.height).toBeCloseTo(100, 1);
}
rect = divs[2].getBoundingClientRect();
expect(rect.left).toBeCloseTo(811.1, 1);
expect(rect.top).toBe(0);
expect(rect.top).toBeCloseTo(0, 1);
rect = divs[3].getBoundingClientRect();
expect(rect.left).toBeCloseTo(811.1, 1);
expect(rect.top).toBe(100);
expect(rect.top).toBeCloseTo(100, 1);
rect = divs[4].getBoundingClientRect();
expect(rect.left).toBeCloseTo(811.1, 1);
expect(rect.top).toBe(200);
expect(rect.top).toBeCloseTo(200, 1);
});

@@ -718,23 +718,23 @@ });

// The last row grows a little bit to take up the extra space
expect(rect.height).toBe(268);
expect(rect.width).toBe(201);
expect(rect.height).toBeCloseTo(268, 1);
expect(rect.width).toBeCloseTo(201, 1);
} else {
expect(rect.height).toBe(266);
expect(rect.width).toBe(200);
expect(rect.height).toBeCloseTo(266, 1);
expect(rect.width).toBeCloseTo(200, 1);
}
}
rect = divs[0].getBoundingClientRect();
expect(rect.left).toBe(0);
expect(rect.top).toBe(0);
expect(rect.left).toBeCloseTo(0, 1);
expect(rect.top).toBeCloseTo(0, 1);
rect = divs[1].getBoundingClientRect();
expect(rect.left).toBe(200);
expect(rect.top).toBe(0);
expect(rect.left).toBeCloseTo(200, 1);
expect(rect.top).toBeCloseTo(0, 1);
rect = divs[2].getBoundingClientRect();
expect(rect.left).toBe(0);
expect(rect.top).toBe(266);
expect(rect.left).toBeCloseTo(0, 1);
expect(rect.top).toBeCloseTo(266, 1);
rect = divs[3].getBoundingClientRect();
expect(rect.left).toBe(200);
expect(rect.top).toBe(266);
expect(rect.left).toBeCloseTo(200, 1);
expect(rect.top).toBeCloseTo(266, 1);
rect = divs[4].getBoundingClientRect();
expect(rect.left).toBe(99.5);
expect(rect.left).toBeCloseTo(99.5, 1);
expect(rect.top).toBeCloseTo(532, 0);

@@ -749,6 +749,6 @@ });

const bigRect = divs[0].getBoundingClientRect();
expect(bigRect.width).toBe(400);
expect(bigRect.height).toBe(600);
expect(bigRect.left).toBe(0);
expect(bigRect.top).toBe(20);
expect(bigRect.width).toBeCloseTo(400, 1);
expect(bigRect.height).toBeCloseTo(600, 1);
expect(bigRect.left).toBeCloseTo(0, 1);
expect(bigRect.top).toBeCloseTo(20, 1);
// Expect them to all have the same width and height

@@ -758,17 +758,17 @@ let rect;

rect = divs[i].getBoundingClientRect();
expect(rect.width).toBe(100);
expect(rect.height).toBe(150);
expect(rect.width).toBeCloseTo(100, 1);
expect(rect.height).toBeCloseTo(150, 1);
}
rect = divs[1].getBoundingClientRect();
expect(rect.left).toBe(0);
expect(rect.top).toBe(645);
expect(rect.left).toBeCloseTo(0, 1);
expect(rect.top).toBeCloseTo(645, 1);
rect = divs[2].getBoundingClientRect();
expect(rect.left).toBe(100);
expect(rect.top).toBe(645);
expect(rect.left).toBeCloseTo(100, 1);
expect(rect.top).toBeCloseTo(645, 1);
rect = divs[3].getBoundingClientRect();
expect(rect.left).toBe(200);
expect(rect.top).toBe(645);
expect(rect.left).toBeCloseTo(200, 1);
expect(rect.top).toBeCloseTo(645, 1);
rect = divs[4].getBoundingClientRect();
expect(rect.left).toBe(300);
expect(rect.top).toBe(645);
expect(rect.left).toBeCloseTo(300, 1);
expect(rect.top).toBeCloseTo(645, 1);
});

@@ -782,4 +782,4 @@

let bigDivRect = divs[0].getBoundingClientRect();
expect(bigDivRect.left).toBe(0);
expect(bigDivRect.top).toBe(160);
expect(bigDivRect.left).toBeCloseTo(0, 1);
expect(bigDivRect.top).toBeCloseTo(160, 1);

@@ -790,4 +790,4 @@ layoutContainer = initLayoutContainer(layoutDiv, { bigFirst: 'row' });

bigDivRect = divs[0].getBoundingClientRect();
expect(bigDivRect.left).toBe(0);
expect(bigDivRect.top).toBe(20);
expect(bigDivRect.left).toBeCloseTo(0, 1);
expect(bigDivRect.top).toBeCloseTo(20, 1);
});

@@ -802,12 +802,12 @@

const bigRect = divs[0].getBoundingClientRect();
expect(bigRect.width).toBe(400);
expect(bigRect.height).toBe(320);
expect(bigRect.left).toBe(0);
expect(bigRect.top).toBe(0);
expect(bigRect.width).toBeCloseTo(400, 1);
expect(bigRect.height).toBeCloseTo(320, 1);
expect(bigRect.left).toBeCloseTo(0, 1);
expect(bigRect.top).toBeCloseTo(0, 1);
// Expect div[1] to be big
const big2Rect = divs[1].getBoundingClientRect();
expect(big2Rect.width).toBe(400);
expect(big2Rect.height).toBe(320);
expect(big2Rect.left).toBe(0);
expect(big2Rect.top).toBe(320);
expect(big2Rect.width).toBeCloseTo(400, 1);
expect(big2Rect.height).toBeCloseTo(320, 1);
expect(big2Rect.left).toBeCloseTo(0, 1);
expect(big2Rect.top).toBeCloseTo(320, 1);
// Expect them to all have the same width and height

@@ -817,14 +817,14 @@ let rect;

rect = divs[i].getBoundingClientRect();
expect(rect.width).toBe(133);
expect(rect.height).toBe(160);
expect(rect.width).toBeCloseTo(133, 1);
expect(rect.height).toBeCloseTo(160, 1);
}
rect = divs[2].getBoundingClientRect();
expect(rect.left).toBe(0.5);
expect(rect.top).toBe(640);
expect(rect.left).toBeCloseTo(0.5, 1);
expect(rect.top).toBeCloseTo(640, 1);
rect = divs[3].getBoundingClientRect();
expect(rect.left).toBe(133.5);
expect(rect.top).toBe(640);
expect(rect.left).toBeCloseTo(133.5, 1);
expect(rect.top).toBeCloseTo(640, 1);
rect = divs[4].getBoundingClientRect();
expect(rect.left).toBe(266.5);
expect(rect.top).toBe(640);
expect(rect.left).toBeCloseTo(266.5, 1);
expect(rect.top).toBeCloseTo(640, 1);
});

@@ -831,0 +831,0 @@ });

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc