input-date-no-resize-on-hover.html (1261B)
1 <!DOCTYPE html> 2 <meta charset="utf-8"> 3 <title>Date input should not resize on hover when using web fonts</title> 4 <link rel="help" href="https://crbug.com/1167555"> 5 <link rel="author" href="mailto:xiaochengh@chromium.org"> 6 <script src="/resources/testharness.js"></script> 7 <script src="/resources/testharnessreport.js"></script> 8 <script src="/resources/testdriver.js"></script> 9 <script src="/resources/testdriver-actions.js"></script> 10 <script src="/resources/testdriver-vendor.js"></script> 11 12 <input id="target" type="date" style="font-family: custom-font"> 13 14 <script> 15 function mouseMoveToTarget(target) { 16 return new test_driver.Actions().pointerMove(0, 0, {origin: target}).send(); 17 } 18 19 promise_test(async () => { 20 // Update layout before font loads 21 document.body.offsetWidth; 22 23 const font_sheet = document.createElement('style'); 24 font_sheet.textContent = '@font-face { font-family: custom-font; src: url(/fonts/Revalia.woff) }'; 25 document.body.appendChild(font_sheet); 26 27 await document.fonts.ready; 28 29 const target = document.getElementById('target'); 30 const width_before_hover = target.offsetWidth; 31 await mouseMoveToTarget(target); 32 const width_after_hover = target.offsetWidth; 33 assert_equals(width_before_hover, width_after_hover); 34 }); 35 </script>