test_tabbrowser.xhtml (3748B)
1 <?xml version="1.0"?> 2 <?xml-stylesheet href="chrome://global/skin" type="text/css"?> 3 <?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" 4 type="text/css"?> 5 6 <window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" 7 title="Accessible XUL tabbrowser relation tests"> 8 9 <script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js" /> 10 <script src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"></script> 11 12 <script type="application/javascript" 13 src="../common.js" /> 14 <script type="application/javascript" 15 src="../role.js" /> 16 <script type="application/javascript" 17 src="../relations.js" /> 18 <script type="application/javascript" 19 src="../events.js" /> 20 <script type="application/javascript" 21 src="../browser.js"></script> 22 23 <script type="application/javascript"> 24 <![CDATA[ 25 //////////////////////////////////////////////////////////////////////////// 26 // Invoker 27 function testTabRelations() 28 { 29 this.eventSeq = [ 30 new asyncInvokerChecker(EVENT_DOCUMENT_LOAD_COMPLETE, tabDocumentAt, 0), 31 new asyncInvokerChecker(EVENT_DOCUMENT_LOAD_COMPLETE, tabDocumentAt, 1) 32 ]; 33 34 this.invoke = function testTabRelations_invoke() 35 { 36 var docURIs = ["about:license", "about:mozilla"]; 37 tabBrowser().loadTabs(docURIs, { 38 inBackground: false, 39 replace: true, 40 triggeringPrincipal: Services.scriptSecurityManager.getSystemPrincipal(), 41 }); 42 // Flush layout, so as to guarantee that the a11y tree is constructed. 43 browserDocument().documentElement.getBoundingClientRect(); 44 } 45 46 this.finalCheck = function testTabRelations_finalCheck() 47 { 48 //////////////////////////////////////////////////////////////////////// 49 // 'labelled by'/'label for' relations for xul:tab and xul:tabpanel 50 51 var tabs = Array.from(tabBrowser().tabContainer.allTabs); 52 // For preloaded tabs, there might be items in this array where this relation 53 // doesn't hold, so just deal with that: 54 var panels = tabs.map(t => t.linkedBrowser.closest("tabpanels > *")); 55 56 testRelation(panels[0], RELATION_LABELLED_BY, tabs[0]); 57 testRelation(tabs[0], RELATION_LABEL_FOR, panels[0]); 58 testRelation(panels[1], RELATION_LABELLED_BY, tabs[1]); 59 testRelation(tabs[1], RELATION_LABEL_FOR, panels[1]); 60 } 61 62 this.getID = function testTabRelations_getID() 63 { 64 return "relations of tabs"; 65 } 66 } 67 68 //////////////////////////////////////////////////////////////////////////// 69 // Test 70 71 //gA11yEventDumpToConsole = true; // debug stuff 72 73 var gQueue = null; 74 function doTest() 75 { 76 // Load documents into tabs and wait for DocLoadComplete events caused by 77 // these documents load before we start the test. 78 79 gQueue = new eventQueue(); 80 81 gQueue.push(new testTabRelations()); 82 gQueue.onFinish = function() { closeBrowserWindow(); } 83 gQueue.invoke(); // Will call SimpleTest.finish(); 84 } 85 86 SimpleTest.waitForExplicitFinish(); 87 openBrowserWindow(doTest); 88 ]]> 89 </script> 90 91 <vbox flex="1" style="overflow: auto;"> 92 <body xmlns="http://www.w3.org/1999/xhtml"> 93 <a target="_blank" 94 href="https://bugzilla.mozilla.org/show_bug.cgi?id=552944" 95 title="No relationship between tabs and associated property page in new tabbrowser construct"> 96 Mozilla Bug 552944 97 </a><br/> 98 <p id="display"></p> 99 <div id="content" style="display: none"> 100 </div> 101 <pre id="test"> 102 </pre> 103 </body> 104 105 <vbox id="eventdump"></vbox> 106 </vbox> 107 108 </window>