accessible/tests/mochitest/name/test_link.html

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/accessible/tests/mochitest/name/test_link.html	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,97 @@
     1.4 +<html>
     1.5 +
     1.6 +<head>
     1.7 +  <title>nsIAccessible::name calculation for HTML links (html:a)</title>
     1.8 +
     1.9 +  <link rel="stylesheet"
    1.10 +        type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css" />
    1.11 +
    1.12 +  <script type="application/javascript"
    1.13 +          src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
    1.14 +
    1.15 +  <script type="application/javascript"
    1.16 +          src="../common.js"></script>
    1.17 +  <script type="application/javascript"
    1.18 +          src="../name.js"></script>
    1.19 +
    1.20 +  <script type="application/javascript">
    1.21 +    function doTest()
    1.22 +    {
    1.23 +      // aria-label
    1.24 +      testName("aria_label", "anchor label");
    1.25 +
    1.26 +      // aria-labelledby
    1.27 +      testName("aria_labelledby", "text");
    1.28 +
    1.29 +      // html:label
    1.30 +      testName("label", "label");
    1.31 +
    1.32 +      // name from content
    1.33 +      testName("namefromcontent", "1");
    1.34 +
    1.35 +      // name from content
    1.36 +      testName("namefromimg", "img title");
    1.37 +
    1.38 +      // no name from content
    1.39 +      testName("nonamefromcontent", null);
    1.40 +
    1.41 +      // title
    1.42 +      testName("title", "title");
    1.43 +
    1.44 +      SimpleTest.finish();
    1.45 +    }
    1.46 +
    1.47 +    SimpleTest.waitForExplicitFinish();
    1.48 +    addA11yLoadEvent(doTest);
    1.49 +  </script>
    1.50 +
    1.51 +</head>
    1.52 +
    1.53 +<body>
    1.54 +
    1.55 +  <a target="_blank"
    1.56 +     href="https://bugzilla.mozilla.org/show_bug.cgi?id=459782"
    1.57 +     title="nsIAccessible::name calculation for HTML links (html:a)">
    1.58 +    Mozilla Bug 459782
    1.59 +  </a>
    1.60 +  <p id="display"></p>
    1.61 +  <div id="content" style="display: none"></div>
    1.62 +  <pre id="test">
    1.63 +  </pre>
    1.64 +
    1.65 +  <!-- aria-label -->
    1.66 +  <a id="aria_label" href="mozilla.org"
    1.67 +     aria-label="anchor label">1</a>
    1.68 +  <br/>
    1.69 +
    1.70 +  <!-- aria-labelledby, preferred to html:label -->
    1.71 +  <span id="text">text</span>
    1.72 +  <label for="aria_labelledby">label</label>
    1.73 +  <a id="aria_labelledby" href="mozilla.org"
    1.74 +     aria-labelledby="text">1</a>
    1.75 +  <br/>
    1.76 +
    1.77 +  <!-- label, preferred to name from content -->
    1.78 +  <label for="label">label</label>
    1.79 +  <a id="label" href="mozilla.org">1</a>
    1.80 +  <br/>
    1.81 +
    1.82 +  <!-- name from content, preferred to @title -->
    1.83 +  <a id="namefromcontent" href="mozilla.org"
    1.84 +     title="title">1</a>
    1.85 +  <br/>
    1.86 +
    1.87 +  <!-- name from content, preferred to @title -->
    1.88 +  <a id="namefromimg" href="mozilla.org"
    1.89 +     title="title"><img alt="img title" /></a>
    1.90 +
    1.91 +  <!-- no name from content, ARIA role overrides this rule -->
    1.92 +  <a id="nonamefromcontent" href="mozilla.org" role="img">1</a>
    1.93 +  <br/>
    1.94 +
    1.95 +  <!-- no content, name from @title -->
    1.96 +  <a id="title" href="mozilla.org"
    1.97 +     title="title"></a>
    1.98 +
    1.99 +</body>
   1.100 +</html>

mercurial