summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/html/semantics/forms/the-textarea-element/textarea-placeholder-lineheight.html
blob: e7df07c97a3760a6d18b7ffe4a8233d5f356df77 (plain)
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
<!DOCTYPE html>
<html>

<head>
  <title>textarea placeholder line-height</title>
  <link rel="author" title="Daniel Libby" href="mailto:dlibby@microsoft.com">
  <script src="/resources/testharness.js"></script>
  <script src="/resources/testharnessreport.js"></script>
  <style>
    textarea {
      margin: 0;
      border: 0;
      padding: 0;
    }
  </style>
</head>

<body>
  <textarea rows=1 placeholder=foo style="border:0"></textarea>
  <script>
    let textarea = document.querySelector('textarea');
    const lineHeight = 19.5;
    textarea.style.lineHeight = lineHeight + "px";
    test(
      function () {
        assert_equals(textarea.getBoundingClientRect().height, lineHeight);
      }, "Bounding rect height for textarea must be the same as line-height");

    test(
      function () {
        assert_equals(getComputedStyle(textarea).lineHeight, lineHeight + "px");
      }, "ComputedStyle line-height for textarea must be the same as set value");
  </script>
</body>

</html>