summaryrefslogtreecommitdiffstats
path: root/accessible/tests/mochitest/tree/test_svg.html
blob: 4a071d0f4a9e716572e0d6873a7eb4b607e85080 (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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
<!DOCTYPE html>
<html>
<head>
  <title>SVG Tree Tests</title>
  <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css" />

  <script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>

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

  <script type="application/javascript">
    function doTest() {
      // svgText
      var accTree = {
        role: ROLE_DIAGRAM,
        children: [
          {
            role: ROLE_TEXT_CONTAINER,
            children: [
              {
                role: ROLE_TEXT_LEAF,
              },
            ],
          },
        ],
      };
      testAccessibleTree("svgText", accTree);

      // svg1
      accTree = {
        role: ROLE_DIAGRAM,
        children: []
      };
      testAccessibleTree("svg1", accTree);

      // svg2
      accTree = {
        role: ROLE_DIAGRAM,
        children: [
          {
            role: ROLE_GROUPING,
            children: []
          }
        ]
      };
      testAccessibleTree("svg2", accTree);

      // svg3
      accTree = {
        role: ROLE_DIAGRAM,
        children: [
          {
            role: ROLE_GRAPHIC,
            children: []
          }
        ]
      };
      testAccessibleTree("svg3", accTree);

      // svg4
      accTree = {
        role: ROLE_DIAGRAM,
        children: [
          {
            role: ROLE_GROUPING,
            children: [
              {
                role: ROLE_GRAPHIC,
                children: []
              }
            ]
          }
        ]
      };
      testAccessibleTree("svg4", accTree);

      SimpleTest.finish();
    }

    SimpleTest.waitForExplicitFinish();
    addA11yLoadEvent(doTest);
  </script>
</head>
<body>
  <p id="display"></p>
  <div id="content" style="display: none"></div>
  <pre id="test">
  </pre>
  <svg id="svgText">
    <text>This is some text</text>
  </svg>

  <!-- no accessible objects -->
  <svg id="svg1">
    <g id="g1">
      <rect width="300" height="100" id="rect1" style="fill:#00f" />
    </g>
  </svg>

  <svg id="svg2">
    <g id="g2">
      <title>g</title>
      <rect width="300" height="100" id="rect2" style="fill:#00f" />
    </g>
  </svg>

  <svg id="svg3">
    <g id="g3">
      <rect width="300" height="100" id="rect3" style="fill:#00f">
        <title>rect</title>
      </rect>
    </g>
  </svg>

  <svg id="svg4">
    <g id="g4">
      <title>g</title>
      <rect width="300" height="100" id="rect4" style="fill:#00f">
        <title>rect</title>
      </rect>
    </g>
  </svg>
</body>
</html>