hunk.code_window:         with:
             args: test:typescript
     unit:
       runs-on: ubuntu-latest
       steps:
         - uses: actions/checkout@v2
  
hunk.labels: keep keep keep keep add keep keep
hunk.after_edit:     container:
         image: ianwalter/puppeteer:3.0.0
         options: --shm-size=1g
  
hunk.file_path: .github/workflows/tests.yml
hunk.type: add
file: // @flow
  import type { ClientRectObject, VirtualElement } from '../types';
  import { isHTMLElement } from './instanceOf';
  
  const round = Math.round;
  
  export default function getBoundingClientRect(
    element: Element | VirtualElement,
    includeScale: boolean = false
  ): ClientRectObject {
    const rect = element.getBoundingClientRect();
    let scaleX = 1;
    let scaleY = 1;
  
    if (isHTMLElement(element) && includeScale) {
      // Fallback to 1 in case both values are `0`
      scaleX = rect.width / element.offsetWidth || 1;
      scaleY = rect.height / element.offsetHeight || 1;
    }
  
    return {
      width: round(rect.width / scaleX),
      height: round(rect.height / scaleY),
      top: round(rect.top / scaleY),
      right: round(rect.right / scaleX),
      bottom: round(rect.bottom / scaleY),
      left: round(rect.left / scaleX),
      x: round(rect.left / scaleX),
      y: round(rect.top / scaleY),
    };
  }
  