chromium/third_party/blink/web_tests/editing/shadow/selection-rangecount.html

<!DOCTYPE html>
<body>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script>
test(() => {
  let span = document.createElement('span');
  document.body.appendChild(span);
  let selectionInShadow = span.attachShadow({mode: 'open'}).getSelection(); 
  getSelection().addRange(document.caretRangeFromPoint()); 
  assert_equals(selectionInShadow.rangeCount, 0);
}, 'rangeCount in ShadowRoot should be 0 if the selection can\'t be represented in the ShadowRoot.');
</script>
</body>