forked from web-platform-tests/wpt
-
Notifications
You must be signed in to change notification settings - Fork 0
/
observer-exceptions.html
48 lines (41 loc) · 1.5 KB
/
observer-exceptions.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
<!DOCTYPE html>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
test(function () {
assert_throws(RangeError(), function() {
new IntersectionObserver(e => {}, {threshold: [1.1]})
})
}, "IntersectionObserver constructor with { threshold: [1.1] }");
test(function () {
assert_throws(TypeError(), function() {
new IntersectionObserver(e => {}, {threshold: ["foo"]})
})
}, 'IntersectionObserver constructor with { threshold: ["foo"] }');
test(function () {
assert_throws("SYNTAX_ERR", function() {
new IntersectionObserver(e => {}, {rootMargin: "1"})
})
}, 'IntersectionObserver constructor witth { rootMargin: "1" }');
test(function () {
assert_throws("SYNTAX_ERR", function() {
new IntersectionObserver(e => {}, {rootMargin: "2em"})
})
}, 'IntersectionObserver constructor with { rootMargin: "2em" }');
test(function () {
assert_throws("SYNTAX_ERR", function() {
new IntersectionObserver(e => {}, {rootMargin: "auto"})
})
}, 'IntersectionObserver constructor width { rootMargin: "auto" }');
test(function () {
assert_throws("SYNTAX_ERR", function() {
new IntersectionObserver(e => {}, {rootMargin: "1px 1px 1px 1px 1px"})
})
}, 'IntersectionObserver constructor with { rootMargin: "1px 1px 1px 1px 1px" }');
test(function () {
assert_throws(TypeError(), function() {
let observer = new IntersectionObserver(c => {}, {});
observer.observe("foo");
})
}, 'IntersectionObserver.observe("foo")');
</script>