accessible/tests/mochitest/treeupdate/test_hidden.html

Fri, 16 Jan 2015 18:13:44 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Fri, 16 Jan 2015 18:13:44 +0100
branch
TOR_BUG_9701
changeset 14
925c144e1f1f
permissions
-rw-r--r--

Integrate suggestion from review to improve consistency with existing code.

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

mercurial