v1
- by ygorbunkov 9/10/202000
Setup HTML - click to add setup HTML
disable setup JavaScript
Setup JavaScript
const src = Array.from(
	{length: 1000},
	() => ({
		x: 0|Math.random()*100,
		y: 0|Math.random()*100
	})
)
delete caserun single casemove downdrag and drop case


ready



const boundingBox = coords => {
	const xArr = coords.map(c => c.x);
const yArr = coords.map(c => c.y);

const l = Math.min(...xArr);
const r = Math.max(...xArr);
const b = Math.min(...yArr);
const t = Math.max(...yArr);

const width  = r - l;
const height = t - b;
return {width, height}
	
}

boundingBox(src)
delete caserun single casemove updrag and drop case


ready



const boundingBox = points => {
	const {width, height} = points.reduce((acc, {x,y}) => {
            const {min, max} = Math
            if(!acc.mX || x < acc.mX){
              acc.mX = x
            } else if (!acc.MX || x > acc.MX){
              acc.MX = x
            }
            if(!acc.mY || y < acc.mY){
              acc.mY = y
            } else if (!acc.MY || y > acc.MY){
              acc.MY = y
            }
            acc.width = acc.MX - acc.mX
            acc.height = acc.MY - acc.mY
            return acc
          }, {width: 0, height: 0})
return {width, height}
}

boundingBox(src)          
Test Case - click to add another test case
Teardown JS - click to add teardown JavaScript
Output (DOM) - click to monitor output (DOM) while test is running
RUN