Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(828)

Side by Side Diff: LayoutTests/intersection-observer/intersection-observer-entry-interface.html

Issue 359780043: WIP for IO
Patch Set: 22 tests pass Created 5 years, 8 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View unified diff | Download patch
OLDNEW
1 <!DOCTYPE html><!-- webkit-test-runner [ enableIntersectionObserver=true ] --> 1 <!DOCTYPE html><!-- webkit-test-runner [ enableIntersectionObserver=true ] -->
2 <head> 2 <head>
3 <title>IntersectionObserverEntry interface tests.</title> 3 <title>IntersectionObserverEntry interface tests.</title>
4 <link rel="author" title="Simon Fraser" href="mailto:simon.fraser@apple.com" /> 4 <link rel="author" title="Simon Fraser" href="mailto:simon.fraser@apple.com" />
5 <link rel="help" href="https://wicg.github.io/IntersectionObserver/"> 5 <link rel="help" href="https://wicg.github.io/IntersectionObserver/">
6 <script src="../resources/testharness.js"></script> 6 <script src="../resources/testharness.js"></script>
7 <script src="../resources/testharnessreport.js"></script> 7 <script src="../resources/testharnessreport.js"></script>
8 </head> 8 </head>
9 <body> 9 <body>
10 <div id="log"></div>
11 <script> 10 <script>
12 11
13 var entryInit = { 12 var entryInit = {
14 time: 9999, 13 time: 9999,
15 rootBounds: { x: 10, y: 12.5, width: 130, height: 140 }, 14 rootBounds: { x: 10, y: 12.5, width: 130, height: 140 },
16 boundingClientRect: { x: 110, y: 112.7, width: 1130, height: 1140 }, 15 boundingClientRect: { x: 110, y: 112.7, width: 1130, height: 1140 },
17 intersectionRect: { x: 210, y: 212, width: 2130, height: 2140 }, 16 intersectionRect: { x: 210, y: 212, width: 2130, height: 2140 },
17 isIntersecting: true,
18 intersectionRatio: 0.35,
18 target: document.body 19 target: document.body
19 }; 20 };
20 21
21 test(function() { 22 test(function() {
22 assert_class_string(new IntersectionObserverEntry(entryInit), 'Intersect ionObserverEntry'); 23 assert_class_string(new IntersectionObserverEntry(entryInit), 'Intersect ionObserverEntry');
23 },'Constructor0'); 24 },'Constructor0');
24 test(function() { 25 test(function() {
25 var entry = new IntersectionObserverEntry(entryInit); 26 var entry = new IntersectionObserverEntry(entryInit);
26 assert_equals(entry.time, 9999); 27 assert_equals(entry.time, 9999);
27 },'ConstructorTime'); 28 },'ConstructorTime');
28 test(function() { 29 test(function() {
29 var entry = new IntersectionObserverEntry(entryInit); 30 var entry = new IntersectionObserverEntry(entryInit);
30 assert_equals(JSON.stringify(entry.rootBounds), '{"x":10,"y":12.5,"width ":130,"height":140,"top":12.5,"right":140,"bottom":152.5,"left":10}'); 31 assert_equals(JSON.stringify(entry.rootBounds), '{"x":10,"y":12.5,"width ":130,"height":140,"top":12.5,"right":140,"bottom":152.5,"left":10}');
31 assert_class_string(entry.rootBounds, 'DOMRectReadOnly'); 32 assert_class_string(entry.rootBounds, 'DOMRectReadOnly');
32 },'ConstructorRootBounds'); 33 },'ConstructorRootBounds');
33 test(function() { 34 test(function() {
34 var entry = new IntersectionObserverEntry(entryInit); 35 var entry = new IntersectionObserverEntry(entryInit);
35 assert_class_string(entry.boundingClientRect, 'DOMRectReadOnly'); 36 assert_class_string(entry.boundingClientRect, 'DOMRectReadOnly');
36 assert_equals(JSON.stringify(entry.boundingClientRect), '{"x":110,"y":11 2.7,"width":1130,"height":1140,"top":112.7,"right":1240,"bottom":1252.7,"left":1 10}'); 37 assert_equals(JSON.stringify(entry.boundingClientRect), '{"x":110,"y":11 2.7,"width":1130,"height":1140,"top":112.7,"right":1240,"bottom":1252.7,"left":1 10}');
37 },'ConstructorBoundingClientRect'); 38 },'ConstructorBoundingClientRect');
38 test(function() { 39 test(function() {
39 var entry = new IntersectionObserverEntry(entryInit); 40 var entry = new IntersectionObserverEntry(entryInit);
40 assert_class_string(entry.intersectionRect, 'DOMRectReadOnly'); 41 assert_class_string(entry.intersectionRect, 'DOMRectReadOnly');
41 assert_equals(JSON.stringify(entry.intersectionRect), '{"x":210,"y":212, "width":2130,"height":2140,"top":212,"right":2340,"bottom":2352,"left":210}'); 42 assert_equals(JSON.stringify(entry.intersectionRect), '{"x":210,"y":212, "width":2130,"height":2140,"top":212,"right":2340,"bottom":2352,"left":210}');
42 },'ConstructorIntersectionRect'); 43 },'ConstructorIntersectionRect');
43 test(function() { 44 test(function() {
44 var entry = new IntersectionObserverEntry(entryInit); 45 var entry = new IntersectionObserverEntry(entryInit);
46 assert_equals(entry.isIntersecting, true);
47 },'ConstructorIsIntersecting');
48 test(function() {
49 var entry = new IntersectionObserverEntry(entryInit);
50 assert_equals(entry.intersectionRatio, 0.35);
51 },'ConstructorIntersectionRatio');
52 test(function() {
53 var entry = new IntersectionObserverEntry(entryInit);
45 assert_equals(entry.target, document.body); 54 assert_equals(entry.target, document.body);
46 },'ConstructorTime'); 55 },'ConstructorTarget');
47 56
48 </script> 57 </script>
49 </body> 58 </body>
50 </html> 59 </html>
OLDNEW

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b