|
| 1 | +<!DOCTYPE html> |
| 2 | +<html> |
| 3 | + <head> |
| 4 | + <title>Find text in overflow node</title> |
| 5 | + <meta name="viewport" content="width=device-width"> |
| 6 | + <script src="../../../../resources/testharness.js"></script> |
| 7 | + <script src="../../../../resources/testharnessreport.js"></script> |
| 8 | + <script type="text/javascript"> |
| 9 | + setup({ "explicit_done": true }); |
| 10 | + function run() { |
| 11 | + if (!window.testRunner || !testRunner.runUIScript) |
| 12 | + return; |
| 13 | + |
| 14 | + var node = document.getElementById("scrollable"); |
| 15 | + test(function() { |
| 16 | + assert_equals(node.scrollTop, 0); |
| 17 | + }, "Initial position of overflow node"); |
| 18 | + var afterMatch3 = async_test("Position of overflow node after the three first results"); |
| 19 | + var afterMatch4 = async_test("Position of overflow node after the fourth result"); |
| 20 | + testRunner.runUIScript(` |
| 21 | + uiController.findString("match", 0, 4); // match |
| 22 | + uiController.findString("match", 0, 4); // match 2 |
| 23 | + uiController.findString("match", 0, 4); // match 3 |
| 24 | + uiController.uiScriptComplete("Done"); |
| 25 | + `, afterMatch3.step_func_done(function() { |
| 26 | + assert_equals(node.scrollTop, 0); |
| 27 | + testRunner.runUIScript(` |
| 28 | + uiController.findString("match", 0, 4); // match 4 |
| 29 | + uiController.uiScriptComplete("Done"); |
| 30 | + `, afterMatch4.step_func_done(function() { |
| 31 | + assert_greater_than(node.scrollTop, 0); |
| 32 | + })); |
| 33 | + })); |
| 34 | + |
| 35 | + done(); |
| 36 | + } |
| 37 | + </script> |
| 38 | + <style> |
| 39 | + #scrollable { |
| 40 | + border: 1px solid black; |
| 41 | + background: gray; |
| 42 | + width: 200px; |
| 43 | + height: 200px; |
| 44 | + overflow-y: auto; |
| 45 | + -webkit-overflow-scrolling: touch; |
| 46 | + } |
| 47 | + </style> |
| 48 | + </head> |
| 49 | + <body onload="run()"> |
| 50 | + <p>Use iOS Find UI to search for the text "match". The following overflow node should scroll to show the fourth result.</p> |
| 51 | + <p>match 2</p> |
| 52 | + <p>match 3</p> |
| 53 | + <div id="scrollable"> |
| 54 | + <div style="height: 200px; background: linear-gradient(135deg, blue, cyan);"></div> |
| 55 | + <p>match 4</p> |
| 56 | + </div> |
| 57 | + </body> |
| 58 | +</html> |
0 commit comments