1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/accessible/tests/mochitest/treeupdate/test_optgroup.html Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,135 @@ 1.4 +<!DOCTYPE html> 1.5 +<html> 1.6 +<head> 1.7 + <title>Add and remove optgroup test</title> 1.8 + <link rel="stylesheet" type="text/css" 1.9 + href="chrome://mochikit/content/tests/SimpleTest/test.css" /> 1.10 + 1.11 + <script type="application/javascript" 1.12 + src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script> 1.13 + 1.14 + <script type="application/javascript" 1.15 + src="../common.js"></script> 1.16 + <script type="application/javascript" 1.17 + src="../role.js"></script> 1.18 + <script type="application/javascript" 1.19 + src="../events.js"></script> 1.20 + 1.21 + <script type="application/javascript"> 1.22 + 1.23 + function addOptGroup(aID) 1.24 + { 1.25 + this.selectNode = getNode(aID); 1.26 + this.select = getAccessible(this.selectNode); 1.27 + 1.28 + this.invoke = function addOptGroup_invoke() 1.29 + { 1.30 + var optGroup = document.createElement("optgroup"); 1.31 + for (i = 0; i < 2; i++) { 1.32 + var opt = document.createElement("option"); 1.33 + opt.value = i; 1.34 + opt.text = "Option: Value " + i; 1.35 + 1.36 + optGroup.appendChild(opt); 1.37 + } 1.38 + 1.39 + this.selectNode.add(optGroup, null); 1.40 + var option = document.createElement("option"); 1.41 + this.selectNode.add(option, null); 1.42 + } 1.43 + 1.44 + this.eventSeq = [ 1.45 + new invokerChecker(EVENT_REORDER, this.select) 1.46 + ]; 1.47 + 1.48 + this.finalCheck = function addOptGroup_finalCheck() 1.49 + { 1.50 + var tree = 1.51 + { COMBOBOX: [ 1.52 + { COMBOBOX_LIST: [ 1.53 + { GROUPING: [ 1.54 + { COMBOBOX_OPTION: [ 1.55 + { TEXT_LEAF: [] } 1.56 + ] }, 1.57 + { COMBOBOX_OPTION: [ 1.58 + { TEXT_LEAF: [] } 1.59 + ] }, 1.60 + ]}, 1.61 + { COMBOBOX_OPTION: [] } 1.62 + ] } 1.63 + ] }; 1.64 + testAccessibleTree(this.select, tree); 1.65 + } 1.66 + 1.67 + this.getID = function addOptGroup_getID() 1.68 + { 1.69 + return "test optgroup's insertion into a select"; 1.70 + } 1.71 + } 1.72 + 1.73 + function removeOptGroup(aID) 1.74 + { 1.75 + this.selectNode = getNode(aID); 1.76 + this.select = getAccessible(this.selectNode); 1.77 + 1.78 + this.invoke = function removeOptGroup_invoke() 1.79 + { 1.80 + this.option1Node = this.selectNode.firstChild.firstChild; 1.81 + this.selectNode.removeChild(this.selectNode.firstChild); 1.82 + } 1.83 + 1.84 + this.eventSeq = [ 1.85 + new invokerChecker(EVENT_REORDER, this.select) 1.86 + ]; 1.87 + 1.88 + this.finalCheck = function removeOptGroup_finalCheck() 1.89 + { 1.90 + var tree = 1.91 + { COMBOBOX: [ 1.92 + { COMBOBOX_LIST: [ 1.93 + { COMBOBOX_OPTION: [] } 1.94 + ] } 1.95 + ] }; 1.96 + testAccessibleTree(this.select, tree); 1.97 + is(isAccessible(this.option1Node), false, "removed option shouldn't be accessible anymore!"); 1.98 + } 1.99 + 1.100 + this.getID = function removeOptGroup_getID() 1.101 + { 1.102 + return "test optgroup's removal from a select"; 1.103 + } 1.104 + } 1.105 + 1.106 +// gA11yEventDumpToConsole = true; 1.107 + 1.108 + function doTest() 1.109 + { 1.110 + gQueue = new eventQueue(); 1.111 + 1.112 + gQueue.push(new addOptGroup("select")); 1.113 + gQueue.push(new removeOptGroup("select")); 1.114 + 1.115 + gQueue.invoke(); // Will call SimpleTest.finish(); 1.116 + 1.117 + } 1.118 + 1.119 + SimpleTest.waitForExplicitFinish(); 1.120 + addA11yLoadEvent(doTest); 1.121 + </script> 1.122 +</head> 1.123 +<body> 1.124 + 1.125 + <a target="_blank" 1.126 + href="https://bugzilla.mozilla.org/show_bug.cgi?id=616452" 1.127 + title="Bug 616452 - Dynamically inserted select options aren't reflected in accessible tree"> 1.128 + Bug 616452</a> 1.129 + <p id="display"></p> 1.130 + <div id="content" style="display: none"></div> 1.131 + <pre id="test"> 1.132 + </pre> 1.133 + 1.134 + <select id="select"></select> 1.135 + 1.136 + <div id="debug"/> 1.137 +</body> 1.138 +</html>