https://github.com/web-platform-tests/wpt
Raw File
Tip revision: 17b2ba52a63e251eea16b419bcd31846f4aebb0f authored by Domenic Denicola on 13 October 2017, 20:36:23 UTC
Test customized built-in elements createElement/createElementNS
Tip revision: 17b2ba5
canvas_focus_drawCustomFocusRing_001.html
<!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>
back to top