-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Expand file tree
/
Copy pathviewport-scale-with-pinch-zoom-out.html
More file actions
48 lines (44 loc) · 1.71 KB
/
viewport-scale-with-pinch-zoom-out.html
File metadata and controls
48 lines (44 loc) · 1.71 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Viewport Scale : Pinch Zoom Out</title>
<link rel=help href="https://github.com/w3c/csswg-drafts/issues/9004">
<link rel=help href="https://www.w3.org/TR/2015/WD-mobile-accessibility-mapping-20150226/#zoom-magnification">
<link rel="author" title="Shubham Gupta" href="mailto:shubham.gupta@chromium.org">
<meta name="assert" content="The page can be pinch zoomed-out.">
<meta name="viewport" content="minimum-scale=0.1, initial-scale=2.0, maximum-scale=10.0">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/resources/testdriver.js"></script>
<script src="/resources/testdriver-actions.js"></script>
<script src="/resources/testdriver-vendor.js"></script>
<script src="/visual-viewport/viewport_support.js"></script>
</head>
<body style="background-color: blue">
<div style="font-size: 50px;">Pinch Zoom Test: Zoom Out</div>
<script>
function waitForScaleChange(previousScale) {
return new Promise(resolve => {
const poll = () => requestAnimationFrame(() => {
if (window.visualViewport.scale !== previousScale) {
resolve();
} else {
poll();
}
});
poll();
});
}
promise_test(async () => {
const initialScale = window.visualViewport.scale;
await pinchZoomOut();
await Promise.race([
waitForScaleChange(initialScale),
new Promise(resolve => step_timeout(resolve, 5000)),
]);
assert_less_than(window.visualViewport.scale, initialScale,
"Scale should be less than initial scale after pinch zoom out");
}) </script>
</body>
</html>