test_docload_iframe.html (2849B)
1 <html> 2 3 <head> 4 <title>Accessible events testing for document</title> 5 6 <link rel="stylesheet" type="text/css" 7 href="chrome://mochikit/content/tests/SimpleTest/test.css" /> 8 9 <script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script> 10 11 <script type="application/javascript" 12 src="../../common.js"></script> 13 <script type="application/javascript" 14 src="../../role.js"></script> 15 <script type="application/javascript" 16 src="../../states.js"></script> 17 <script type="application/javascript" 18 src="../../events.js"></script> 19 20 <script type="application/javascript"> 21 // ////////////////////////////////////////////////////////////////////////// 22 // Invokers 23 24 const kHide = 1; 25 const kShow = 2; 26 const kRemove = 3; 27 28 function morphIFrame(aIdentifier, aAction) { 29 this.DOMNode = getNode(aIdentifier); 30 this.IFrameContainerDOMNode = this.DOMNode.parentNode; 31 32 this.eventSeq = [ 33 new invokerChecker(aAction === kShow ? EVENT_SHOW : EVENT_HIDE, this.DOMNode), 34 new invokerChecker(EVENT_REORDER, this.IFrameContainerDOMNode), 35 ]; 36 37 this.invoke = () => { 38 if (aAction === kRemove) { 39 this.IFrameContainerDOMNode.removeChild(this.DOMNode); 40 } else { 41 this.DOMNode.style.display = aAction === kHide ? "none" : "block"; 42 } 43 }; 44 45 this.finalCheck = () => 46 testAccessibleTree(this.IFrameContainerDOMNode, { 47 role: ROLE_SECTION, 48 children: (aAction == kHide || aAction == kRemove) ? [ ] : 49 [ 50 { 51 role: ROLE_INTERNAL_FRAME, 52 children: [ 53 { role: ROLE_DOCUMENT }, 54 ], 55 }, 56 ], 57 }); 58 59 this.getID = () => { 60 if (aAction === kRemove) { 61 return "remove iframe"; 62 } 63 64 return `change display style of iframe to ${aAction === kHide ? "none" : "block"}`; 65 }; 66 } 67 68 // ////////////////////////////////////////////////////////////////////////// 69 // Do tests 70 71 function doTests() { 72 const gQueue = new eventQueue(EVENT_REORDER); 73 gQueue.push(new morphIFrame("iframe", kHide)); 74 gQueue.push(new morphIFrame("iframe", kShow)); 75 gQueue.push(new morphIFrame("iframe", kRemove)); 76 gQueue.invoke(); // Will call SimpleTest.finish(); 77 } 78 79 SimpleTest.waitForExplicitFinish(); 80 addA11yLoadEvent(doTests); 81 </script> 82 </head> 83 84 <body> 85 86 <a target="_blank" 87 href="https://bugzilla.mozilla.org/show_bug.cgi?id=566103" 88 title="Reorganize accessible document handling"> 89 Mozilla Bug 566103 90 </a> 91 92 <p id="display"></p> 93 <div id="content" style="display: none"></div> 94 <pre id="test"> 95 </pre> 96 97 <div id="testContainer"><iframe id="iframe"></iframe></div> 98 </body> 99 </html>