summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/2dcontext/drawing-paths-to-the-canvas/canvas_focus_drawCustomFocusRing_001.html
blob: 56d5ebb51576e488205b15e5a4f79363938b35d5 (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
38
39
40
41
<!DOCTYPE html>
<html>
  <head>
    <title>canvas drawCustomFocusRing() step1 test</title>
    <script src="/resources/testharness.js"></script>
    <script src="/resources/testharnessreport.js"></script>
    <link rel="author" title="Takeshi Kurosawa" href="mailto:kurosawa-takeshi@mitsue.co.jp">
    <link rel="help" href="http://www.w3.org/TR/2dcontext/#dom-context-2d-drawcustomfocusring">
  </head>
  <body>
    <h1>Description</h1>
    <p>This test checks whether drawCustomFocusRing returns false if the element passed as an argument is not focused or is not a descendant of the element with whose context the method is associated.</p>
    <div id="log"></div>
    <div>
      <input type="text" id="text0">
      <canvas id="canvas"><input type="text" id="text1"></canvas>
    </div>
    <script>
    (function() {
      test(function() {
          var canvas = document.getElementById('canvas');
          var context = canvas.getContext('2d');
          var text0 = document.getElementById('text0');
          text0.focus(); // document.activeElement === text0;

          var text1 = document.getElementById('text1');
          assert_false(context.drawCustomFocusRing(text1));
      }, 'drawCustomFocusRing must return false for an element that is not focused.');

      test(function() {
          var canvas = document.getElementById('canvas');
          var context = canvas.getContext('2d');
          var text0 = document.getElementById('text0');
          text0.focus(); // document.activeElement === text0;

          assert_false(context.drawCustomFocusRing(text0));
      }, 'drawCustomFocusRing must return false for an element that is not a descendant of the canvas element.');
    })();
    </script>
  </body>
</html>