accessible/tests/mochitest/treeupdate/test_select.html

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/accessible/tests/mochitest/treeupdate/test_select.html	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,128 @@
     1.4 +<!DOCTYPE html>
     1.5 +<html>
     1.6 +<head>
     1.7 +  <title>Add select options test</title>
     1.8 +  <link rel="stylesheet" type="text/css"
     1.9 +        href="chrome://mochikit/content/tests/SimpleTest/test.css" />
    1.10 +
    1.11 +  <script type="application/javascript"
    1.12 +          src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
    1.13 +
    1.14 +  <script type="application/javascript"
    1.15 +          src="../common.js"></script>
    1.16 +  <script type="application/javascript"
    1.17 +          src="../role.js"></script>
    1.18 +  <script type="application/javascript"
    1.19 +          src="../events.js"></script>
    1.20 +
    1.21 +  <script type="application/javascript">
    1.22 +
    1.23 +    function addOptions(aID)
    1.24 +    {
    1.25 +      this.selectNode = getNode(aID);
    1.26 +      this.select = getAccessible(this.selectNode);
    1.27 +
    1.28 +      this.invoke = function addOptions_invoke()
    1.29 +      {
    1.30 +        for (i = 0; i < 2; i++) {
    1.31 +          var opt = document.createElement("option");
    1.32 +          opt.value = i;
    1.33 +          opt.text = "Option: Value " + i;
    1.34 +
    1.35 +          this.selectNode.add(opt, null);
    1.36 +        }
    1.37 +      }
    1.38 +
    1.39 +      this.eventSeq = [
    1.40 +        new invokerChecker(EVENT_REORDER, this.select)
    1.41 +      ];
    1.42 +
    1.43 +      this.finalCheck = function addOptions_finalCheck()
    1.44 +      {
    1.45 +        var tree =
    1.46 +          { COMBOBOX: [
    1.47 +            { COMBOBOX_LIST: [
    1.48 +              { COMBOBOX_OPTION: [
    1.49 +                { TEXT_LEAF: [] }
    1.50 +              ] },
    1.51 +              { COMBOBOX_OPTION: [
    1.52 +                { TEXT_LEAF: [] }
    1.53 +              ] }
    1.54 +            ] }
    1.55 +          ] };
    1.56 +        testAccessibleTree(this.select, tree);
    1.57 +      }
    1.58 +
    1.59 +      this.getID = function addOptions_getID()
    1.60 +      {
    1.61 +        return "test elements insertion into a select";
    1.62 +      }
    1.63 +    }
    1.64 +
    1.65 +    function removeOptions(aID)
    1.66 +    {
    1.67 +      this.selectNode = getNode(aID);
    1.68 +      this.select = getAccessible(this.selectNode);
    1.69 +
    1.70 +      this.invoke = function removeOptions_invoke()
    1.71 +      {
    1.72 +        while (this.selectNode.length)
    1.73 +          this.selectNode.remove(0);
    1.74 +      }
    1.75 +
    1.76 +      this.eventSeq = [
    1.77 +        new invokerChecker(EVENT_REORDER, this.select)
    1.78 +      ];
    1.79 +
    1.80 +      this.finalCheck = function removeOptions_finalCheck()
    1.81 +      {
    1.82 +        var tree =
    1.83 +          { COMBOBOX: [
    1.84 +            { COMBOBOX_LIST: [] }
    1.85 +          ] };
    1.86 +        testAccessibleTree(this.select, tree);
    1.87 +      }
    1.88 +
    1.89 +      this.getID = function removeptions_getID()
    1.90 +      {
    1.91 +        return "test elements removal from a select";
    1.92 +      }
    1.93 +    }
    1.94 +
    1.95 +    //gA11yEventDumpID = "debug";
    1.96 +
    1.97 +    function doTest()
    1.98 +    {
    1.99 +      gQueue = new eventQueue();
   1.100 +
   1.101 +      gQueue.push(new addOptions("select"));
   1.102 +      gQueue.push(new removeOptions("select"));
   1.103 +
   1.104 +      gQueue.invoke(); // Will call SimpleTest.finish();
   1.105 +
   1.106 +    }
   1.107 +
   1.108 +    SimpleTest.waitForExplicitFinish();
   1.109 +    addA11yLoadEvent(doTest);
   1.110 +  </script>
   1.111 +</head>
   1.112 +<body>
   1.113 +
   1.114 +  <a target="_blank"
   1.115 +     href="https://bugzilla.mozilla.org/show_bug.cgi?id=616452"
   1.116 +     title="Bug 616452 - Dynamically inserted select options aren't reflected in accessible tree">
   1.117 +    Mozilla Bug 616452</a>
   1.118 +  <a target="_blank"
   1.119 +     href="https://bugzilla.mozilla.org/show_bug.cgi?id=616940"
   1.120 +     title="Removed select option accessibles aren't removed until hide event is fired">
   1.121 +    Mozilla Bug 616940</a>
   1.122 +  <p id="display"></p>
   1.123 +  <div id="content" style="display: none"></div>
   1.124 +  <pre id="test">
   1.125 +  </pre>
   1.126 +
   1.127 +  <select id="select"></select>
   1.128 +
   1.129 +  <div id="debug"/>
   1.130 +</body>
   1.131 +</html>

mercurial