ajuma@chromium.org | eda30cb | 2019-09-13 18:46:56 +0000 | [diff] [blame] | 1 | <!DOCTYPE html> |
| 2 | <script src="../resources/testharness.js"></script> |
| 3 | <script src="../resources/testharnessreport.js"></script> |
| 4 | <style> |
| 5 | #container { |
| 6 | width: 100%; |
| 7 | transform: translateZ(0); |
| 8 | overflow: hidden; |
| 9 | } |
| 10 | |
| 11 | #target { |
| 12 | margin-top: 0.66px; |
| 13 | height: 40px; |
| 14 | background-color: green; |
| 15 | } |
| 16 | </style> |
| 17 | |
| 18 | <div id="container"> |
| 19 | <div id="target"></div> |
| 20 | </div> |
| 21 | |
| 22 | <script> |
| 23 | async_test((t) => { |
| 24 | let observer = new IntersectionObserver(t.step_func_done((entries) => { |
| 25 | assert_true(entries[0].isIntersecting, "isIntersecting"); |
| 26 | assert_equals(entries[0].intersectionRatio, 1, "intersectionRatio"); |
| 27 | assert_equals(entries[0].intersectionRect.height, entries[0].boundingClientRect.height, "intersectionRect.height"); |
| 28 | })); |
| 29 | observer.observe(document.getElementById("target")); |
| 30 | }, "IntersectionObserverEntry's intersection rect is not larger than the target rect"); |
| 31 | </script> |