test_hidden.html (3189B)
1 <!DOCTYPE html> 2 <html> 3 4 <head> 5 <title>@hidden attribute testing</title> 6 7 <link rel="stylesheet" type="text/css" 8 href="chrome://mochikit/content/tests/SimpleTest/test.css" /> 9 10 <script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script> 11 12 <script type="application/javascript" 13 src="../common.js"></script> 14 <script type="application/javascript" 15 src="../role.js"></script> 16 <script type="application/javascript" 17 src="../events.js"></script> 18 19 <script type="application/javascript"> 20 21 // ////////////////////////////////////////////////////////////////////////// 22 // Invokers 23 // ////////////////////////////////////////////////////////////////////////// 24 25 /** 26 * Set @hidden attribute 27 */ 28 function setHiddenAttr(aContainerID, aChildID) { 29 this.eventSeq = [ 30 new invokerChecker(EVENT_REORDER, getNode(aContainerID)), 31 ]; 32 33 this.invoke = function setHiddenAttr_invoke() { 34 var tree = 35 { SECTION: [ 36 { ENTRY: [ 37 ] }, 38 ] }; 39 testAccessibleTree(aContainerID, tree); 40 41 getNode(aChildID).setAttribute("hidden", "true"); 42 }; 43 44 this.finalCheck = function setHiddenAttr_finalCheck() { 45 var tree = 46 { SECTION: [ 47 ] }; 48 testAccessibleTree(aContainerID, tree); 49 }; 50 51 this.getID = function setHiddenAttr_getID() { 52 return "Set @hidden attribute on input and test accessible tree for div"; 53 }; 54 } 55 56 /** 57 * Remove @hidden attribute 58 */ 59 function removeHiddenAttr(aContainerID, aChildID) { 60 this.eventSeq = [ 61 new invokerChecker(EVENT_REORDER, getNode(aContainerID)), 62 ]; 63 64 this.invoke = function removeHiddenAttr_invoke() { 65 var tree = 66 { SECTION: [ 67 ] }; 68 testAccessibleTree(aContainerID, tree); 69 70 getNode(aChildID).removeAttribute("hidden"); 71 }; 72 73 this.finalCheck = function removeHiddenAttr_finalCheck() { 74 var tree = 75 { SECTION: [ 76 { ENTRY: [ 77 ] }, 78 ] }; 79 testAccessibleTree(aContainerID, tree); 80 }; 81 82 this.getID = function removeHiddenAttr_getID() { 83 return "Remove @hidden attribute on input and test accessible tree for div"; 84 }; 85 } 86 87 // ////////////////////////////////////////////////////////////////////////// 88 // Test 89 // ////////////////////////////////////////////////////////////////////////// 90 91 // gA11yEventDumpID = "eventdump"; // debug stuff 92 // gA11yEventDumpToConsole = true; 93 94 var gQueue = null; 95 96 function doTest() { 97 gQueue = new eventQueue(); 98 99 gQueue.push(new setHiddenAttr("container", "child")); 100 gQueue.push(new removeHiddenAttr("container", "child")); 101 102 gQueue.invoke(); // SimpleTest.finish() will be called in the end 103 } 104 105 SimpleTest.waitForExplicitFinish(); 106 addA11yLoadEvent(doTest); 107 108 </script> 109 110 </head> 111 112 <body> 113 114 <p id="display"></p> 115 <div id="content" style="display: none"></div> 116 <pre id="test"> 117 </pre> 118 119 <div id="container"><input id="child"></div> 120 121 <div id="eventdump"></div> 122 123 </body> 124 125 </html>