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

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

Issue 2088963002: IntersectionObserver constructor: fail on invalid rootMargin syntax. (Closed) Base URL: https://chromium.googlesource.com/chromium/src@master
Patch Set: Simplify loop condition Created 4 years, 6 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
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <script src="../resources/js-test.js"></script> 2 <script src="../resources/js-test.js"></script>
3 <script src="../resources/intersection-observer-helper-functions.js"></script> 3 <script src="../resources/intersection-observer-helper-functions.js"></script>
4 <div style="width:100%; height:700px;"></div> 4 <div style="width:100%; height:700px;"></div>
5 <div style="white-space: nowrap;"> 5 <div style="white-space: nowrap;">
6 <div style="display: inline-block; width: 1000px; height: 100px"></div> 6 <div style="display: inline-block; width: 1000px; height: 100px"></div>
7 <div id="target" style="display: inline-block; background-color: green; width: 100px; height:100px"></div> 7 <div id="target" style="display: inline-block; background-color: green; width: 100px; height:100px"></div>
8 <div style="display: inline-block; width: 1000px; height: 100px"></div> 8 <div style="display: inline-block; width: 1000px; height: 100px"></div>
9 </div> 9 </div>
10 <div style="width:100%; height:700px;"></div> 10 <div style="width:100%; height:700px;"></div>
11 11
12 <script> 12 <script>
13 description("Intersection observer test with root margin and implicit root."); 13 description("Intersection observer test with root margin and implicit root.");
14 var target = document.getElementById("target"); 14 var target = document.getElementById("target");
15 var entries = []; 15 var entries = [];
16 var observer = new IntersectionObserver( 16 var observer = new IntersectionObserver(
17 changes => { entries = entries.concat(changes) }, 17 changes => { entries = entries.concat(changes) },
18 { rootMargin: "10px 20% 40% 30px" } 18 { rootMargin: "10px 20% 40% 30px" }
19 ); 19 );
20 20
21 shouldNotThrow("new IntersectionObserver(c => {}, { rootMargin: '1.4px' })"); 21 shouldNotThrow("new IntersectionObserver(c => {}, { rootMargin: '1.4px' })");
22 shouldNotThrow("new IntersectionObserver(c => {}, { rootMargin: '1.4px 2px' })") ; 22 shouldNotThrow("new IntersectionObserver(c => {}, { rootMargin: '1.4px 2px' })") ;
23 shouldNotThrow("new IntersectionObserver(c => {}, { rootMargin: '1.4px 2px 3%' } )"); 23 shouldNotThrow("new IntersectionObserver(c => {}, { rootMargin: '1.4px 2px 3%' } )");
24 shouldNotThrow("new IntersectionObserver(c => {}, { rootMargin: '1.4px 2px 3% 40 px junk junk junk' })");
25 24
26 onload = function() { 25 onload = function() {
27 observer.observe(target); 26 observer.observe(target);
28 entries = entries.concat(observer.takeRecords()); 27 entries = entries.concat(observer.takeRecords());
29 shouldBeEqualToNumber("entries.length", 0); 28 shouldBeEqualToNumber("entries.length", 0);
30 waitForNotification(step0); 29 waitForNotification(step0);
31 } 30 }
32 31
33 function step0() { 32 function step0() {
34 shouldBeEqualToNumber("entries.length", 0); 33 shouldBeEqualToNumber("entries.length", 0);
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 shouldBeEqualToNumber("entries[1].rootBounds.right", 942); 78 shouldBeEqualToNumber("entries[1].rootBounds.right", 942);
80 shouldBeEqualToNumber("entries[1].rootBounds.top", -10); 79 shouldBeEqualToNumber("entries[1].rootBounds.top", -10);
81 shouldBeEqualToNumber("entries[1].rootBounds.bottom", 819); 80 shouldBeEqualToNumber("entries[1].rootBounds.bottom", 819);
82 shouldEvaluateToSameObject("entries[1].target", target); 81 shouldEvaluateToSameObject("entries[1].target", target);
83 } 82 }
84 finishJSTest(); 83 finishJSTest();
85 document.scrollingElement.scrollLeft = 0; 84 document.scrollingElement.scrollLeft = 0;
86 document.scrollingElement.scrollTop = 0; 85 document.scrollingElement.scrollTop = 0;
87 } 86 }
88 </script> 87 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698