accessible/tests/mochitest/relations/test_bindings.xhtml

branch
TOR_BUG_9701
changeset 8
97036ab72558
equal deleted inserted replaced
-1:000000000000 0:27ef4501b753
1 <html xmlns="http://www.w3.org/1999/xhtml">
2
3 <head>
4 <title>Accessible relations for bindings</title>
5
6 <link rel="stylesheet" type="text/css"
7 href="chrome://mochikit/content/tests/SimpleTest/test.css" />
8
9 <style>
10 .button {
11 -moz-binding: url('#custombutton');
12 }
13
14 .button2 {
15 -moz-binding: url('#custombutton2');
16 }
17 </style>
18
19 <bindings xmlns="http://www.mozilla.org/xbl">
20 <binding id="custombutton">
21 <content aria-labelledby="button.label label">
22 <label xmlns="http://www.w3.org/1999/xhtml" anonid="button.label">
23 anon label
24 </label>
25 <button xmlns="http://www.w3.org/1999/xhtml" anonid="button.button"
26 aria-labelledby="button.label label">
27 a button
28 </button>
29 <div xmlns="http://www.w3.org/1999/xhtml"
30 anonid="button.button2" class="button2"
31 aria-labelledby="button.label"></div>
32 <div xmlns="http://www.w3.org/1999/xhtml"
33 anonid="button.button3" class="button2"></div>
34 </content>
35 </binding>
36 <binding id="custombutton2">
37 <content aria-labelledby="button2.label">
38 <label xmlns="http://www.w3.org/1999/xhtml" anonid="button2.label">
39 nested anon label
40 </label>
41 </content>
42 </binding>
43 </bindings>
44
45 <script type="application/javascript"
46 src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
47 <script type="application/javascript"
48 src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"></script>
49
50 <script type="application/javascript"
51 src="../common.js"></script>
52 <script type="application/javascript"
53 src="../relations.js"></script>
54
55 <script type="application/javascript">
56 function doTests()
57 {
58 var button = document.getElementById("button");
59 var anonLabel = document.
60 getAnonymousElementByAttribute(button, "anonid", "button.label");
61 var anonButton = document.
62 getAnonymousElementByAttribute(button, "anonid", "button.button");
63 var anonButton2 = document.
64 getAnonymousElementByAttribute(button, "anonid", "button.button2");
65 var anonButton3 = document.
66 getAnonymousElementByAttribute(button, "anonid", "button.button3");
67 var anonAnonLabel = document.
68 getAnonymousElementByAttribute(anonButton3, "anonid", "button2.label");
69
70 testRelation("label", RELATION_LABEL_FOR, button);
71 testRelation(anonLabel, RELATION_LABEL_FOR, [button, anonButton, anonButton2]);
72 testRelation(button, RELATION_LABELLED_BY, [anonLabel, "label"]);
73 testRelation(anonButton, RELATION_LABELLED_BY, anonLabel);
74 testRelation(anonButton2, RELATION_LABELLED_BY, anonLabel);
75 testRelation(anonButton3, RELATION_LABELLED_BY, anonAnonLabel);
76 testRelation(anonAnonLabel, RELATION_LABEL_FOR, anonButton3);
77
78 SimpleTest.finish();
79 }
80
81 SimpleTest.waitForExplicitFinish();
82 addA11yLoadEvent(doTests);
83 </script>
84 </head>
85
86 <body>
87
88 <a target="_blank"
89 href="https://bugzilla.mozilla.org/show_bug.cgi?id=421242"
90 title="Allow relations in anonymous content for binding parent">
91 Mozilla Bug 421242
92 </a>
93
94 <p id="display"></p>
95 <div id="content" style="display: none"></div>
96 <pre id="test">
97 </pre>
98 <div id="eventdump"></div>
99
100 <label id="label">explicit label</label>
101 <div id="button" class="button"></div>
102 </body>
103 </html>

mercurial