| Index: third_party/WebKit/LayoutTests/intersection-observer/observer-exceptions.html
|
| diff --git a/third_party/WebKit/LayoutTests/intersection-observer/observer-exceptions.html b/third_party/WebKit/LayoutTests/intersection-observer/observer-exceptions.html
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..1da557dd409739693a25bf3a4dd0e801d8d2203f
|
| --- /dev/null
|
| +++ b/third_party/WebKit/LayoutTests/intersection-observer/observer-exceptions.html
|
| @@ -0,0 +1,53 @@
|
| +<!DOCTYPE html>
|
| +<div id="root"></div>
|
| +<script src="../resources/js-test.js"></script>
|
| +<script src="../resources/gc.js"></script>
|
| +<script>
|
| + description("Test for observer exceptions.");
|
| + let rootDiv = document.getElementById("root");
|
| + var exc;
|
| +
|
| + try {
|
| + new IntersectionObserver(e => {}, {threshold: [1.1]});
|
| + testFailed("IntersectionObserver constructor did not throw due to invalid threshold.");
|
| + } catch(e) {
|
| + exc = e;
|
| + shouldBeType("exc", "RangeError");
|
| + }
|
| +
|
| + try {
|
| + new IntersectionObserver(e => {}, {rootMargin: "1"});
|
| + testFailed("IntersectionObserver constructor did not throw due to invalid rootMargin.");
|
| + } catch(e) {
|
| + exc = e;
|
| + shouldBeType("exc", "DOMException");
|
| + shouldBe("exc.code", "DOMException.SYNTAX_ERR");
|
| + }
|
| +
|
| + try {
|
| + new IntersectionObserver(e => {}, {rootMargin: "2em"});
|
| + testFailed("IntersectionObserver constructor did not throw due to invalid rootMargin.");
|
| + } catch(e) {
|
| + exc = e;
|
| + shouldBeType("exc", "DOMException");
|
| + shouldBe("exc.code", "DOMException.SYNTAX_ERR");
|
| + }
|
| +
|
| + try {
|
| + new IntersectionObserver(e => {}, {rootMargin: "auto"});
|
| + testFailed("IntersectionObserver constructor did not throw due to invalid rootMargin.");
|
| + } catch(e) {
|
| + exc = e;
|
| + shouldBeType("exc", "DOMException");
|
| + shouldBe("exc.code", "DOMException.SYNTAX_ERR");
|
| + }
|
| +
|
| + let observer = new IntersectionObserver(c => {}, {});
|
| + try {
|
| + observer.observe("foo");
|
| + testFailed("IntersectionObserver.observe with a bad target argument did not throw.");
|
| + } catch(e) {
|
| + exc = e;
|
| + shouldBeType("exc", "TypeError");
|
| + }
|
| +</script>
|
|
|