LEFT | RIGHT |
(no file at all) | |
| 1 <!DOCTYPE html> |
| 2 <script src="/resources/testharness.js"></script> |
| 3 <script src="/resources/testharnessreport.js"></script> |
| 4 |
| 5 <script> |
| 6 test(function () { |
| 7 assert_throws(RangeError(), function() { |
| 8 new IntersectionObserver(e => {}, {threshold: [1.1]}) |
| 9 }) |
| 10 }, "IntersectionObserver constructor with { threshold: [1.1] }"); |
| 11 |
| 12 test(function () { |
| 13 assert_throws(TypeError(), function() { |
| 14 new IntersectionObserver(e => {}, {threshold: ["foo"]}) |
| 15 }) |
| 16 }, 'IntersectionObserver constructor with { threshold: ["foo"] }'); |
| 17 |
| 18 test(function () { |
| 19 assert_throws("SYNTAX_ERR", function() { |
| 20 new IntersectionObserver(e => {}, {rootMargin: "1"}) |
| 21 }) |
| 22 }, 'IntersectionObserver constructor witth { rootMargin: "1" }'); |
| 23 |
| 24 test(function () { |
| 25 assert_throws("SYNTAX_ERR", function() { |
| 26 new IntersectionObserver(e => {}, {rootMargin: "2em"}) |
| 27 }) |
| 28 }, 'IntersectionObserver constructor with { rootMargin: "2em" }'); |
| 29 |
| 30 test(function () { |
| 31 assert_throws("SYNTAX_ERR", function() { |
| 32 new IntersectionObserver(e => {}, {rootMargin: "auto"}) |
| 33 }) |
| 34 }, 'IntersectionObserver constructor with { rootMargin: "auto" }'); |
| 35 |
| 36 test(function () { |
| 37 assert_throws("SYNTAX_ERR", function() { |
| 38 new IntersectionObserver(e => {}, {rootMargin: "calc(1px + 2px)"}) |
| 39 }) |
| 40 }, 'IntersectionObserver constructor with { rootMargin: "calc(1px + 2px)" }'); |
| 41 |
| 42 test(function () { |
| 43 assert_throws("SYNTAX_ERR", function() { |
| 44 new IntersectionObserver(e => {}, {rootMargin: "1px !important"}) |
| 45 }) |
| 46 }, 'IntersectionObserver constructor with { rootMargin: "1px !important" }'); |
| 47 |
| 48 test(function () { |
| 49 assert_throws("SYNTAX_ERR", function() { |
| 50 new IntersectionObserver(e => {}, {rootMargin: "1px 1px 1px 1px 1px"}) |
| 51 }) |
| 52 }, 'IntersectionObserver constructor with { rootMargin: "1px 1px 1px 1px 1px" }'
); |
| 53 |
| 54 test(function () { |
| 55 assert_throws(TypeError(), function() { |
| 56 let observer = new IntersectionObserver(c => {}, {}); |
| 57 observer.observe("foo"); |
| 58 }) |
| 59 }, 'IntersectionObserver.observe("foo")'); |
| 60 </script> |
LEFT | RIGHT |