Fri, 16 Jan 2015 18:13:44 +0100
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>Test HTML li and listitem bullet accessible cache</title> |
michael@0 | 6 | <link rel="stylesheet" type="text/css" |
michael@0 | 7 | href="chrome://mochikit/content/tests/SimpleTest/test.css" /> |
michael@0 | 8 | |
michael@0 | 9 | <script type="application/javascript" |
michael@0 | 10 | src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script> |
michael@0 | 11 | |
michael@0 | 12 | <script type="application/javascript" |
michael@0 | 13 | src="../common.js"></script> |
michael@0 | 14 | <script type="application/javascript" |
michael@0 | 15 | src="../role.js"></script> |
michael@0 | 16 | <script type="application/javascript" |
michael@0 | 17 | src="../events.js"></script> |
michael@0 | 18 | |
michael@0 | 19 | <script type="application/javascript"> |
michael@0 | 20 | |
michael@0 | 21 | //////////////////////////////////////////////////////////////////////////// |
michael@0 | 22 | // Helpers |
michael@0 | 23 | |
michael@0 | 24 | function testLiAccessibleTree() |
michael@0 | 25 | { |
michael@0 | 26 | // Test accessible tree. |
michael@0 | 27 | var accTree = { |
michael@0 | 28 | role: ROLE_LISTITEM, |
michael@0 | 29 | children: [ |
michael@0 | 30 | { |
michael@0 | 31 | role: ROLE_STATICTEXT, |
michael@0 | 32 | children: [] |
michael@0 | 33 | }, |
michael@0 | 34 | { |
michael@0 | 35 | role: ROLE_TEXT_LEAF, |
michael@0 | 36 | children: [] |
michael@0 | 37 | } |
michael@0 | 38 | ] |
michael@0 | 39 | }; |
michael@0 | 40 | |
michael@0 | 41 | testAccessibleTree("li", accTree); |
michael@0 | 42 | } |
michael@0 | 43 | |
michael@0 | 44 | //////////////////////////////////////////////////////////////////////////// |
michael@0 | 45 | // Sequence item processors |
michael@0 | 46 | |
michael@0 | 47 | function hideProcessor() |
michael@0 | 48 | { |
michael@0 | 49 | this.liNode = getNode("li"); |
michael@0 | 50 | this.li = getAccessible(this.liNode); |
michael@0 | 51 | this.bullet = this.li.firstChild; |
michael@0 | 52 | |
michael@0 | 53 | this.process = function hideProcessor_process() |
michael@0 | 54 | { |
michael@0 | 55 | this.liNode.style.display = "none"; |
michael@0 | 56 | } |
michael@0 | 57 | |
michael@0 | 58 | this.onProcessed = function hideProcessor_onProcessed() |
michael@0 | 59 | { |
michael@0 | 60 | window.setTimeout( |
michael@0 | 61 | function(aLiAcc, aLiNode, aBulletAcc) |
michael@0 | 62 | { |
michael@0 | 63 | testDefunctAccessible(aLiAcc, aLiNode); |
michael@0 | 64 | testDefunctAccessible(aBulletAcc); |
michael@0 | 65 | |
michael@0 | 66 | gSequence.processNext(); |
michael@0 | 67 | }, |
michael@0 | 68 | 0, this.li, this.liNode, this.bullet |
michael@0 | 69 | ); |
michael@0 | 70 | } |
michael@0 | 71 | }; |
michael@0 | 72 | |
michael@0 | 73 | function showProcessor() |
michael@0 | 74 | { |
michael@0 | 75 | this.liNode = getNode("li"); |
michael@0 | 76 | |
michael@0 | 77 | this.process = function showProcessor_process() |
michael@0 | 78 | { |
michael@0 | 79 | this.liNode.style.display = "list-item"; |
michael@0 | 80 | } |
michael@0 | 81 | |
michael@0 | 82 | this.onProcessed = function showProcessor_onProcessed() |
michael@0 | 83 | { |
michael@0 | 84 | testLiAccessibleTree(); |
michael@0 | 85 | SimpleTest.finish(); |
michael@0 | 86 | } |
michael@0 | 87 | }; |
michael@0 | 88 | |
michael@0 | 89 | //////////////////////////////////////////////////////////////////////////// |
michael@0 | 90 | // Test |
michael@0 | 91 | |
michael@0 | 92 | var gSequence = null; |
michael@0 | 93 | |
michael@0 | 94 | function doTest() |
michael@0 | 95 | { |
michael@0 | 96 | testLiAccessibleTree(); |
michael@0 | 97 | |
michael@0 | 98 | gSequence = new sequence(); |
michael@0 | 99 | |
michael@0 | 100 | gSequence.append(new hideProcessor(), EVENT_HIDE, getAccessible("li"), |
michael@0 | 101 | "hide HTML li"); |
michael@0 | 102 | gSequence.append(new showProcessor(), EVENT_SHOW, getNode("li"), |
michael@0 | 103 | "show HTML li"); |
michael@0 | 104 | |
michael@0 | 105 | gSequence.processNext(); // SimpleTest.finish() will be called in the end |
michael@0 | 106 | } |
michael@0 | 107 | |
michael@0 | 108 | SimpleTest.waitForExplicitFinish(); |
michael@0 | 109 | addA11yLoadEvent(doTest); |
michael@0 | 110 | </script> |
michael@0 | 111 | </head> |
michael@0 | 112 | <body> |
michael@0 | 113 | |
michael@0 | 114 | <a target="_blank" |
michael@0 | 115 | title="setParent shouldn't be virtual" |
michael@0 | 116 | href="https://bugzilla.mozilla.org/show_bug.cgi?id=496783">Mozilla Bug 496783</a> |
michael@0 | 117 | |
michael@0 | 118 | <p id="display"></p> |
michael@0 | 119 | <div id="content" style="display: none"></div> |
michael@0 | 120 | <pre id="test"> |
michael@0 | 121 | </pre> |
michael@0 | 122 | |
michael@0 | 123 | <ul> |
michael@0 | 124 | <li id="li">item1</li> |
michael@0 | 125 | </ul> |
michael@0 | 126 | </body> |
michael@0 | 127 | </html> |