1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/accessible/tests/mochitest/relations/test_bindings.xhtml Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,103 @@ 1.4 +<html xmlns="http://www.w3.org/1999/xhtml"> 1.5 + 1.6 +<head> 1.7 + <title>Accessible relations for bindings</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 + <style> 1.13 + .button { 1.14 + -moz-binding: url('#custombutton'); 1.15 + } 1.16 + 1.17 + .button2 { 1.18 + -moz-binding: url('#custombutton2'); 1.19 + } 1.20 + </style> 1.21 + 1.22 + <bindings xmlns="http://www.mozilla.org/xbl"> 1.23 + <binding id="custombutton"> 1.24 + <content aria-labelledby="button.label label"> 1.25 + <label xmlns="http://www.w3.org/1999/xhtml" anonid="button.label"> 1.26 + anon label 1.27 + </label> 1.28 + <button xmlns="http://www.w3.org/1999/xhtml" anonid="button.button" 1.29 + aria-labelledby="button.label label"> 1.30 + a button 1.31 + </button> 1.32 + <div xmlns="http://www.w3.org/1999/xhtml" 1.33 + anonid="button.button2" class="button2" 1.34 + aria-labelledby="button.label"></div> 1.35 + <div xmlns="http://www.w3.org/1999/xhtml" 1.36 + anonid="button.button3" class="button2"></div> 1.37 + </content> 1.38 + </binding> 1.39 + <binding id="custombutton2"> 1.40 + <content aria-labelledby="button2.label"> 1.41 + <label xmlns="http://www.w3.org/1999/xhtml" anonid="button2.label"> 1.42 + nested anon label 1.43 + </label> 1.44 + </content> 1.45 + </binding> 1.46 + </bindings> 1.47 + 1.48 + <script type="application/javascript" 1.49 + src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script> 1.50 + <script type="application/javascript" 1.51 + src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"></script> 1.52 + 1.53 + <script type="application/javascript" 1.54 + src="../common.js"></script> 1.55 + <script type="application/javascript" 1.56 + src="../relations.js"></script> 1.57 + 1.58 + <script type="application/javascript"> 1.59 + function doTests() 1.60 + { 1.61 + var button = document.getElementById("button"); 1.62 + var anonLabel = document. 1.63 + getAnonymousElementByAttribute(button, "anonid", "button.label"); 1.64 + var anonButton = document. 1.65 + getAnonymousElementByAttribute(button, "anonid", "button.button"); 1.66 + var anonButton2 = document. 1.67 + getAnonymousElementByAttribute(button, "anonid", "button.button2"); 1.68 + var anonButton3 = document. 1.69 + getAnonymousElementByAttribute(button, "anonid", "button.button3"); 1.70 + var anonAnonLabel = document. 1.71 + getAnonymousElementByAttribute(anonButton3, "anonid", "button2.label"); 1.72 + 1.73 + testRelation("label", RELATION_LABEL_FOR, button); 1.74 + testRelation(anonLabel, RELATION_LABEL_FOR, [button, anonButton, anonButton2]); 1.75 + testRelation(button, RELATION_LABELLED_BY, [anonLabel, "label"]); 1.76 + testRelation(anonButton, RELATION_LABELLED_BY, anonLabel); 1.77 + testRelation(anonButton2, RELATION_LABELLED_BY, anonLabel); 1.78 + testRelation(anonButton3, RELATION_LABELLED_BY, anonAnonLabel); 1.79 + testRelation(anonAnonLabel, RELATION_LABEL_FOR, anonButton3); 1.80 + 1.81 + SimpleTest.finish(); 1.82 + } 1.83 + 1.84 + SimpleTest.waitForExplicitFinish(); 1.85 + addA11yLoadEvent(doTests); 1.86 + </script> 1.87 +</head> 1.88 + 1.89 +<body> 1.90 + 1.91 + <a target="_blank" 1.92 + href="https://bugzilla.mozilla.org/show_bug.cgi?id=421242" 1.93 + title="Allow relations in anonymous content for binding parent"> 1.94 + Mozilla Bug 421242 1.95 + </a> 1.96 + 1.97 + <p id="display"></p> 1.98 + <div id="content" style="display: none"></div> 1.99 + <pre id="test"> 1.100 + </pre> 1.101 + <div id="eventdump"></div> 1.102 + 1.103 + <label id="label">explicit label</label> 1.104 + <div id="button" class="button"></div> 1.105 +</body> 1.106 +</html>