summaryrefslogtreecommitdiffstats
path: root/accessible/tests/mochitest/bounds/test_select.html
blob: 395dad1b697921601a9bbe7fe8b9a2b311439f6d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
<!DOCTYPE html>
<html>
<head>
  <title>Accessible boundaries when page is zoomed</title>
  <link rel="stylesheet" type="text/css"
        href="chrome://mochikit/content/tests/SimpleTest/test.css" />

  <script type="application/javascript"
          src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
  <script type="application/javascript"
          src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"></script>

  <script type="application/javascript"
          src="../common.js"></script>
  <script type="application/javascript"
          src="../role.js"></script>
  <script type="application/javascript"
          src="../layout.js"></script>
  <script type="application/javascript"
          src="../events.js"></script>

  <script type="application/javascript">
    function openComboboxNCheckBounds(aID)
    {
      this.combobox = getAccessible(aID);
      this.comboboxList = this.combobox.firstChild;
      this.comboboxOption = this.comboboxList.firstChild;

      this.eventSeq = [
        new invokerChecker(EVENT_FOCUS, this.comboboxOption)
      ];

      this.invoke = function openComboboxNCheckBounds_invoke()
      {
        getNode(aID).focus();
        synthesizeKey("VK_DOWN", { altKey: true });
      }

      this.finalCheck = function openComboboxNCheckBounds_invoke()
      {
        testBounds(this.comboboxOption);
      }

      this.getID = function openComboboxNCheckBounds_getID()
      {
        return "open combobox and test boundaries";
      }
    }

    //gA11yEventDumpToConsole = true;

    var gQueue = null;

    function doTest()
    {
      // Combobox
      testBounds("combobox");

      // Option boundaries matches to combobox boundaries when collapsed.
      var selectBounds = getBoundsForDOMElm("combobox");
      testBounds("option1", selectBounds);

      // Open combobox and test option boundaries.
      gQueue = new eventQueue();
      gQueue.push(new openComboboxNCheckBounds("combobox"));
      gQueue.invoke(); // Will call SimpleTest.finish();
    }

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

  <p id="display"></p>
  <div id="content" style="display: none"></div>
  <pre id="test">
  </pre>

  <select id="combobox">
    <option id="option1">item1</option>
    <option>item2</option>
  </select>
</body>
</html>