1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/accessible/tests/mochitest/treeupdate/test_list.html Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,127 @@ 1.4 +<!DOCTYPE html> 1.5 +<html> 1.6 + 1.7 +<head> 1.8 + <title>Test HTML li and listitem bullet accessible cache</title> 1.9 + <link rel="stylesheet" type="text/css" 1.10 + href="chrome://mochikit/content/tests/SimpleTest/test.css" /> 1.11 + 1.12 + <script type="application/javascript" 1.13 + src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script> 1.14 + 1.15 + <script type="application/javascript" 1.16 + src="../common.js"></script> 1.17 + <script type="application/javascript" 1.18 + src="../role.js"></script> 1.19 + <script type="application/javascript" 1.20 + src="../events.js"></script> 1.21 + 1.22 + <script type="application/javascript"> 1.23 + 1.24 + //////////////////////////////////////////////////////////////////////////// 1.25 + // Helpers 1.26 + 1.27 + function testLiAccessibleTree() 1.28 + { 1.29 + // Test accessible tree. 1.30 + var accTree = { 1.31 + role: ROLE_LISTITEM, 1.32 + children: [ 1.33 + { 1.34 + role: ROLE_STATICTEXT, 1.35 + children: [] 1.36 + }, 1.37 + { 1.38 + role: ROLE_TEXT_LEAF, 1.39 + children: [] 1.40 + } 1.41 + ] 1.42 + }; 1.43 + 1.44 + testAccessibleTree("li", accTree); 1.45 + } 1.46 + 1.47 + //////////////////////////////////////////////////////////////////////////// 1.48 + // Sequence item processors 1.49 + 1.50 + function hideProcessor() 1.51 + { 1.52 + this.liNode = getNode("li"); 1.53 + this.li = getAccessible(this.liNode); 1.54 + this.bullet = this.li.firstChild; 1.55 + 1.56 + this.process = function hideProcessor_process() 1.57 + { 1.58 + this.liNode.style.display = "none"; 1.59 + } 1.60 + 1.61 + this.onProcessed = function hideProcessor_onProcessed() 1.62 + { 1.63 + window.setTimeout( 1.64 + function(aLiAcc, aLiNode, aBulletAcc) 1.65 + { 1.66 + testDefunctAccessible(aLiAcc, aLiNode); 1.67 + testDefunctAccessible(aBulletAcc); 1.68 + 1.69 + gSequence.processNext(); 1.70 + }, 1.71 + 0, this.li, this.liNode, this.bullet 1.72 + ); 1.73 + } 1.74 + }; 1.75 + 1.76 + function showProcessor() 1.77 + { 1.78 + this.liNode = getNode("li"); 1.79 + 1.80 + this.process = function showProcessor_process() 1.81 + { 1.82 + this.liNode.style.display = "list-item"; 1.83 + } 1.84 + 1.85 + this.onProcessed = function showProcessor_onProcessed() 1.86 + { 1.87 + testLiAccessibleTree(); 1.88 + SimpleTest.finish(); 1.89 + } 1.90 + }; 1.91 + 1.92 + //////////////////////////////////////////////////////////////////////////// 1.93 + // Test 1.94 + 1.95 + var gSequence = null; 1.96 + 1.97 + function doTest() 1.98 + { 1.99 + testLiAccessibleTree(); 1.100 + 1.101 + gSequence = new sequence(); 1.102 + 1.103 + gSequence.append(new hideProcessor(), EVENT_HIDE, getAccessible("li"), 1.104 + "hide HTML li"); 1.105 + gSequence.append(new showProcessor(), EVENT_SHOW, getNode("li"), 1.106 + "show HTML li"); 1.107 + 1.108 + gSequence.processNext(); // SimpleTest.finish() will be called in the end 1.109 + } 1.110 + 1.111 + SimpleTest.waitForExplicitFinish(); 1.112 + addA11yLoadEvent(doTest); 1.113 + </script> 1.114 +</head> 1.115 +<body> 1.116 + 1.117 + <a target="_blank" 1.118 + title="setParent shouldn't be virtual" 1.119 + href="https://bugzilla.mozilla.org/show_bug.cgi?id=496783">Mozilla Bug 496783</a> 1.120 + 1.121 + <p id="display"></p> 1.122 + <div id="content" style="display: none"></div> 1.123 + <pre id="test"> 1.124 + </pre> 1.125 + 1.126 + <ul> 1.127 + <li id="li">item1</li> 1.128 + </ul> 1.129 +</body> 1.130 +</html>