Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(119)

Side by Side Diff: third_party/WebKit/LayoutTests/intersection-observer/observer-exceptions.html

Issue 1740923004: IntersectionObserver: make exceptions match spec (Closed) Base URL: https://chromium.googlesource.com/chromium/src@master
Patch Set: ASSERT observer constructor succeeded if no exception was thrown Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 <!DOCTYPE html>
2 <div id="root"></div>
3 <script src="../resources/js-test.js"></script>
4 <script src="../resources/gc.js"></script>
5 <script>
6 description("Test for observer exceptions.");
7 let rootDiv = document.getElementById("root");
8 var exc;
9
10 try {
11 new IntersectionObserver(e => {}, {threshold: [1.1]});
12 testFailed("IntersectionObserver constructor did not throw due to invalid th reshold.");
13 } catch(e) {
14 exc = e;
15 shouldBeType("exc", "RangeError");
16 }
17
18 try {
19 new IntersectionObserver(e => {}, {rootMargin: "1"});
20 testFailed("IntersectionObserver constructor did not throw due to invalid ro otMargin.");
21 } catch(e) {
22 exc = e;
23 shouldBeType("exc", "DOMException");
24 shouldBe("exc.code", "DOMException.SYNTAX_ERR");
25 }
26
27 try {
28 new IntersectionObserver(e => {}, {rootMargin: "2em"});
29 testFailed("IntersectionObserver constructor did not throw due to invalid ro otMargin.");
30 } catch(e) {
31 exc = e;
32 shouldBeType("exc", "DOMException");
33 shouldBe("exc.code", "DOMException.SYNTAX_ERR");
34 }
35
36 try {
37 new IntersectionObserver(e => {}, {rootMargin: "auto"});
38 testFailed("IntersectionObserver constructor did not throw due to invalid ro otMargin.");
39 } catch(e) {
40 exc = e;
41 shouldBeType("exc", "DOMException");
42 shouldBe("exc.code", "DOMException.SYNTAX_ERR");
43 }
44
45 let observer = new IntersectionObserver(c => {}, {});
46 try {
47 observer.observe("foo");
48 testFailed("IntersectionObserver.observe with a bad target argument did not throw.");
49 } catch(e) {
50 exc = e;
51 shouldBeType("exc", "TypeError");
52 }
53 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698