summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/intersection-observer/observer-exceptions.html
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 00:47:55 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 00:47:55 +0000
commit26a029d407be480d791972afb5975cf62c9360a6 (patch)
treef435a8308119effd964b339f76abb83a57c29483 /testing/web-platform/tests/intersection-observer/observer-exceptions.html
parentInitial commit. (diff)
downloadfirefox-26a029d407be480d791972afb5975cf62c9360a6.tar.xz
firefox-26a029d407be480d791972afb5975cf62c9360a6.zip
Adding upstream version 124.0.1.upstream/124.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'testing/web-platform/tests/intersection-observer/observer-exceptions.html')
-rw-r--r--testing/web-platform/tests/intersection-observer/observer-exceptions.html61
1 files changed, 61 insertions, 0 deletions
diff --git a/testing/web-platform/tests/intersection-observer/observer-exceptions.html b/testing/web-platform/tests/intersection-observer/observer-exceptions.html
new file mode 100644
index 0000000000..126790f290
--- /dev/null
+++ b/testing/web-platform/tests/intersection-observer/observer-exceptions.html
@@ -0,0 +1,61 @@
+<!DOCTYPE html>
+<meta name="viewport" content="width=device-width,initial-scale=1">
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+
+<script>
+test(function () {
+ assert_throws_js(RangeError, function() {
+ new IntersectionObserver(e => {}, {threshold: [1.1]})
+ })
+}, "IntersectionObserver constructor with { threshold: [1.1] }");
+
+test(function () {
+ assert_throws_js(TypeError, function() {
+ new IntersectionObserver(e => {}, {threshold: ["foo"]})
+ })
+}, 'IntersectionObserver constructor with { threshold: ["foo"] }');
+
+test(function () {
+ assert_throws_dom("SYNTAX_ERR", function() {
+ new IntersectionObserver(e => {}, {rootMargin: "1"})
+ })
+}, 'IntersectionObserver constructor with { rootMargin: "1" }');
+
+test(function () {
+ assert_throws_dom("SYNTAX_ERR", function() {
+ new IntersectionObserver(e => {}, {rootMargin: "2em"})
+ })
+}, 'IntersectionObserver constructor with { rootMargin: "2em" }');
+
+test(function () {
+ assert_throws_dom("SYNTAX_ERR", function() {
+ new IntersectionObserver(e => {}, {rootMargin: "auto"})
+ })
+}, 'IntersectionObserver constructor with { rootMargin: "auto" }');
+
+test(function () {
+ assert_throws_dom("SYNTAX_ERR", function() {
+ new IntersectionObserver(e => {}, {rootMargin: "calc(1px + 2px)"})
+ })
+}, 'IntersectionObserver constructor with { rootMargin: "calc(1px + 2px)" }');
+
+test(function () {
+ assert_throws_dom("SYNTAX_ERR", function() {
+ new IntersectionObserver(e => {}, {rootMargin: "1px !important"})
+ })
+}, 'IntersectionObserver constructor with { rootMargin: "1px !important" }');
+
+test(function () {
+ assert_throws_dom("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_js(TypeError, function() {
+ let observer = new IntersectionObserver(c => {}, {});
+ observer.observe("foo");
+ })
+}, 'IntersectionObserver.observe("foo")');
+</script>