huridocs/uwazi

View on GitHub
app/react/utils/mockRangeSelection.js

Summary

Maintainability
A
0 mins
Test Coverage
export default function mockRangeSelection(selectedText = '') {
  const range = {};

  range.range = 'range';
  range.getClientRects = () => [{ top: 100 }];

  window.getSelection = () => ({
    toString: () => selectedText,
    getRangeAt: () => range,
  });

  return range;
}