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

Side by Side Diff: LayoutTests/platform/chromium/accessibility/scroll-to-make-visible-div-overflow.html

Issue 14120003: Move LayoutTests from platform/chromium/... to generic location (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 8 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 | Annotate | Revision Log
OLDNEW
(Empty)
1 <html>
2 <head>
3 <link rel="stylesheet" href="../../../fast/js/resources/js-test-style.css">
4 <script src="../../../fast/js/resources/js-test-pre.js"></script>
5 </head>
6 <body>
7
8 <p id="description"></p>
9
10 <div id="container" style="height: 100px; overflow: scroll">
11 <button id="upper_target">Upper Target</button>
12 <div style="border: 1px solid #000; height: 5000px;">5000-pixel box</div>
13 <button id="lower_target">Lower Target</button>
14 </div>
15
16 <div id="console"></div>
17
18 <script>
19 description("Tests that scrolling to make an element visible successfully scroll s an arbitrary HTML element that has CSS overflow set to 'scroll'.");
20
21 function runTest() {
22 window.container = document.getElementById("container");
23 var upperTarget = document.getElementById("upper_target");
24 var lowerTarget = document.getElementById("lower_target");
25
26 if (window.accessibilityController) {
27 lowerTarget.focus();
28 var lowerTargetAccessibleObject = accessibilityController.focusedElement ;
29 upperTarget.focus();
30 var upperTargetAccessibleObject = accessibilityController.focusedElement ;
31 }
32
33 // Reset the initial scroll position (since calling focus() can scroll the p age too).
34 container.scrollTop = 0;
35 shouldBe("container.scrollTop", "0");
36
37 // Scroll to make lower target visible and check.
38 if (window.accessibilityController)
39 lowerTargetAccessibleObject.scrollToMakeVisible();
40 var top = lowerTarget.offsetTop - container.offsetTop;
41 window.minYOffset = top + lowerTarget.offsetHeight - container.offsetHeight;
42 window.maxYOffset = top;
43 shouldBe("container.scrollTop >= minYOffset", "true");
44 shouldBe("container.scrollTop <= maxYOffset", "true");
45
46 // Scroll to make upper target visible and check.
47 if (window.accessibilityController)
48 upperTargetAccessibleObject.scrollToMakeVisible();
49 top = upperTarget.offsetTop - container.offsetTop;
50 window.minYOffset = top + upperTarget.offsetHeight - container.offsetHeight;
51 window.maxYOffset = top;
52 shouldBe("container.scrollTop >= minYOffset", "true");
53 shouldBe("container.scrollTop <= maxYOffset", "true");
54
55 finishJSTest();
56 }
57
58 runTest();
59
60 </script>
61
62 <script src="../../../fast/js/resources/js-test-post.js"></script>
63 </body>
64 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698