accessible/tests/mochitest/events/test_selection.html

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/accessible/tests/mochitest/events/test_selection.html	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,120 @@
     1.4 +<html>
     1.5 +
     1.6 +<head>
     1.7 +  <title>Accessible selection event testing</title>
     1.8 +
     1.9 +  <link rel="stylesheet" type="text/css"
    1.10 +        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 +  <script type="application/javascript"
    1.15 +          src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"></script>
    1.16 +
    1.17 +  <script type="application/javascript"
    1.18 +          src="../common.js"></script>
    1.19 +  <script type="application/javascript"
    1.20 +          src="../events.js"></script>
    1.21 +  <script type="application/javascript"
    1.22 +          src="../role.js"></script>
    1.23 +  <script type="application/javascript"
    1.24 +          src="../states.js"></script>
    1.25 +
    1.26 +  <script type="application/javascript">
    1.27 +    ////////////////////////////////////////////////////////////////////////////
    1.28 +    // Invokers
    1.29 +
    1.30 +    ////////////////////////////////////////////////////////////////////////////
    1.31 +    // Do tests
    1.32 +
    1.33 +    //gA11yEventDumpToConsole = true; // debuggin
    1.34 +
    1.35 +    var gQueue = null;
    1.36 +    function doTests()
    1.37 +    {
    1.38 +      gQueue = new eventQueue();
    1.39 +
    1.40 +      // open combobox
    1.41 +      gQueue.push(new synthClick("combobox",
    1.42 +                                 new invokerChecker(EVENT_FOCUS, "cb1_item1")));
    1.43 +      gQueue.push(new synthDownKey("cb1_item1",
    1.44 +                                   selChangeSeq("cb1_item1", "cb1_item2")));
    1.45 +
    1.46 +      // closed combobox
    1.47 +      gQueue.push(new synthEscapeKey("combobox",
    1.48 +                                     new invokerChecker(EVENT_FOCUS, "combobox")));
    1.49 +      gQueue.push(new synthDownKey("cb1_item2",
    1.50 +                                   selChangeSeq("cb1_item2", "cb1_item3")));
    1.51 +
    1.52 +      // listbox
    1.53 +      gQueue.push(new synthClick("lb1_item1",
    1.54 +                                 new invokerChecker(EVENT_SELECTION, "lb1_item1")));
    1.55 +      gQueue.push(new synthDownKey("lb1_item1",
    1.56 +                                   selChangeSeq("lb1_item1", "lb1_item2")));
    1.57 +
    1.58 +      // multiselectable listbox
    1.59 +      gQueue.push(new synthClick("lb2_item1",
    1.60 +                                 selChangeSeq(null, "lb2_item1")));
    1.61 +      gQueue.push(new synthDownKey("lb2_item1",
    1.62 +                                   selAddSeq("lb2_item2"),
    1.63 +                                   { shiftKey: true }));
    1.64 +      gQueue.push(new synthUpKey("lb2_item2",
    1.65 +                                 selRemoveSeq("lb2_item2"),
    1.66 +                                 { shiftKey: true }));
    1.67 +      gQueue.push(new synthKey("lb2_item1", " ", { ctrlKey: true },
    1.68 +                               selRemoveSeq("lb2_item1")));
    1.69 +
    1.70 +      gQueue.invoke(); // Will call SimpleTest.finish();
    1.71 +    }
    1.72 +
    1.73 +    SimpleTest.waitForExplicitFinish();
    1.74 +    addA11yLoadEvent(doTests);
    1.75 +  </script>
    1.76 +</head>
    1.77 +
    1.78 +<body>
    1.79 +
    1.80 +  <a target="_blank"
    1.81 +     href="https://bugzilla.mozilla.org/show_bug.cgi?id=414302"
    1.82 +     title="Incorrect selection events in HTML, XUL and ARIA">
    1.83 +    Bug 414302
    1.84 +  </a>
    1.85 +  <a target="_blank"
    1.86 +     href="https://bugzilla.mozilla.org/show_bug.cgi?id=810268"
    1.87 +     title="There's no way to know unselected item when selection in single selection was changed">
    1.88 +    Bug 810268
    1.89 +  </a>
    1.90 +
    1.91 +  <p id="display"></p>
    1.92 +  <div id="content" style="display: none"></div>
    1.93 +  <pre id="test">
    1.94 +  </pre>
    1.95 +
    1.96 +  <select id="combobox">
    1.97 +    <option id="cb1_item1" value="mushrooms">mushrooms
    1.98 +    <option id="cb1_item2" value="greenpeppers">green peppers
    1.99 +    <option id="cb1_item3" value="onions" id="onions">onions
   1.100 +    <option id="cb1_item4" value="tomatoes">tomatoes
   1.101 +    <option id="cb1_item5" value="olives">olives
   1.102 +  </select>
   1.103 +
   1.104 +  <select id="listbox" size=5>
   1.105 +    <option id="lb1_item1" value="mushrooms">mushrooms
   1.106 +    <option id="lb1_item2" value="greenpeppers">green peppers
   1.107 +    <option id="lb1_item3" value="onions" id="onions">onions
   1.108 +    <option id="lb1_item4" value="tomatoes">tomatoes
   1.109 +    <option id="lb1_item5" value="olives">olives
   1.110 +  </select>
   1.111 +
   1.112 +  <p>Pizza</p>
   1.113 +  <select id="listbox2" multiple size=5>
   1.114 +    <option id="lb2_item1" value="mushrooms">mushrooms
   1.115 +    <option id="lb2_item2" value="greenpeppers">green peppers
   1.116 +    <option id="lb2_item3" value="onions" id="onions">onions
   1.117 +    <option id="lb2_item4" value="tomatoes">tomatoes
   1.118 +    <option id="lb2_item5" value="olives">olives
   1.119 +  </select>
   1.120 +
   1.121 +  <div id="eventdump"></div>
   1.122 +</body>
   1.123 +</html>

mercurial