accessible/tests/mochitest/text/test_hypertext.html
author Alexander Surkov <surkov.alexander@gmail.com>
Thu, 03 Feb 2011 22:29:05 +0800
changeset 61842 f6cbc806e87cdf852218c232bd261666a4844f88
parent 61730 6a2099306114ea14cac313611b15fdbc82bb610a
child 64000 7252330fc7167619d0abe056d1f60f1e469546e4
permissions -rw-r--r--
Bug 631160 - embedded accessible may expose wrong text, r=marcoz, davidb, a=betaN

<!DOCTYPE html>
<html>
<head>
  <title>nsIAccessibleText getText related function tests for rich text</title>
  <link rel="stylesheet" type="text/css"
        href="chrome://mochikit/content/tests/SimpleTest/test.css" />

  <script type="application/javascript"
          src="chrome://mochikit/content/MochiKit/packed.js"></script>
  <script type="application/javascript"
          src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
  <script type="application/javascript"
          src="../common.js"></script>
  <script type="application/javascript"
          src="../text.js"></script>

  <script type="application/javascript">
    function doTest()
    {
      //////////////////////////////////////////////////////////////////////////
      // hypertext
      //////////////////////////////////////////////////////////////////////////

      // ! - embedded object char
      // __h__e__l__l__o__ __!__ __s__e__e__ __!__
      //  0  1  2  3  4  5  6  7  8  9 10 11 12 13

      var IDs = [ "hypertext", "hypertext2" ];

      ////////////////////////////////////////////////////////////////////////
      // characterCount

      testCharacterCount(IDs, 13);

      ////////////////////////////////////////////////////////////////////////
      // getText

      testText(IDs, 0, 1, "h");
      testText(IDs, 5, 7, " " + kEmbedChar);
      testText(IDs, 10, 13, "e " + kEmbedChar);
      testText(IDs, 0, 13, "hello " + kEmbedChar + " see " + kEmbedChar);

      //////////////////////////////////////////////////////////////////////////
      // list
      //////////////////////////////////////////////////////////////////////////

      IDs = [ "list" ];
      testCharacterCount(IDs, 1);
      testText(IDs, 0, 1, kEmbedChar);

      IDs = [ "listitem" ];
      testCharacterCount(IDs, 5);
      testText(IDs, 0, 5, "1.foo");

      SimpleTest.finish();
    }

    SimpleTest.waitForExplicitFinish();
    addA11yLoadEvent(doTest);
  </script>
</head>
<body>

  <a target="_blank"
     title="Fix getText"
     href="https://bugzilla.mozilla.org/show_bug.cgi?id=630001">Mozilla Bug 630001, part3</a>
  <p id="display"></p>
  <div id="content" style="display: none"></div>
  <pre id="test">
  </pre>

  <div id="hypertext">hello <a>friend</a> see <img></div>
  <div id="hypertext2">hello <a>friend</a> see <input></div>
  <ol id="list"><li id="listitem">foo</li></ol>

</body>
</html>