chromium/third_party/blink/web_tests/fast/forms/text/input-appearance-scroll-size-mocked.html

<html>
<script src="../../../resources/testharness.js"></script>
<script src="../../../resources/testharnessreport.js"></script>
<body>
<p>Verify that the scroll size does not grow</p>
<div><input id="input" style="width: 10px; height: 6px; font-size: 100px"></div>
<div><textarea id="textarea" style="width: 10px; height: 6px; font-size: 100px">
</textarea></div>
<script>
test(() => {
  var value = 'Foooooooooooooooooooooooooooooooooooo';

  var input = document.getElementById('input');
  var initialScrollWidth = input.scrollWidth;
  var initialScrollHeight = input.scrollHeight;

  internals.setSuggestedValue(input, value);
  var suggestedScrollWidth = input.scrollWidth;
  var suggestedScrollHeight = input.scrollHeight;

  assert_approx_equals(initialScrollWidth, suggestedScrollWidth, 1,
      'Suggestion should not increase the scroll width');
  assert_approx_equals(initialScrollHeight, suggestedScrollHeight, 1,
      'Suggestion should not increase the scroll height');
}, 'Testing that <input> elements\' scroll size does not grow by suggesting a value.');

test(() => {
  var value = 'Foooooooooooooooooooooooooooooooooooo';

  var input = document.getElementById('textarea');
  var initialScrollWidth = input.scrollWidth;
  var initialScrollHeight = input.scrollHeight;

  internals.setSuggestedValue(input, value);
  var suggestedScrollWidth = input.scrollWidth;
  var suggestedScrollHeight = input.scrollHeight;

  assert_approx_equals(initialScrollWidth, suggestedScrollWidth, 1,
      'Suggestion should not increase the scroll width');
  assert_approx_equals(initialScrollHeight, suggestedScrollHeight, 1,
      'Suggestion should not increase the scroll height');
}, 'Testing that <textarea> elements\' scroll size does not grow by suggesting a value.');

</script>
</body>
</html>