accessible/tests/mochitest/treeupdate/test_listbox.xul

Sat, 03 Jan 2015 20:18:00 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Sat, 03 Jan 2015 20:18:00 +0100
branch
TOR_BUG_3246
changeset 7
129ffea94266
permissions
-rw-r--r--

Conditionally enable double key logic according to:
private browsing mode or privacy.thirdparty.isolate preference and
implement in GetCookieStringCommon and FindCookie where it counts...
With some reservations of how to convince FindCookie users to test
condition and pass a nullptr when disabling double key logic.

michael@0 1 <?xml version="1.0"?>
michael@0 2 <?xml-stylesheet href="chrome://global/skin" type="text/css"?>
michael@0 3 <?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css"
michael@0 4 type="text/css"?>
michael@0 5
michael@0 6 <window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
michael@0 7 title="Accessible XUL listbox hierarchy tests">
michael@0 8
michael@0 9 <script type="application/javascript"
michael@0 10 src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js" />
michael@0 11
michael@0 12 <script type="application/javascript"
michael@0 13 src="../common.js" />
michael@0 14 <script type="application/javascript"
michael@0 15 src="../role.js" />
michael@0 16 <script type="application/javascript"
michael@0 17 src="../events.js" />
michael@0 18
michael@0 19 <script type="application/javascript">
michael@0 20 <![CDATA[
michael@0 21 ////////////////////////////////////////////////////////////////////////////
michael@0 22 // Test
michael@0 23
michael@0 24 function insertListitem(aListboxID)
michael@0 25 {
michael@0 26 this.listboxNode = getNode(aListboxID);
michael@0 27
michael@0 28 this.listitemNode = document.createElement("listitem");
michael@0 29 this.listitemNode.setAttribute("label", "item1");
michael@0 30
michael@0 31 this.eventSeq = [
michael@0 32 new invokerChecker(EVENT_SHOW, this.listitemNode),
michael@0 33 new invokerChecker(EVENT_REORDER, this.listboxNode)
michael@0 34 ];
michael@0 35
michael@0 36 this.invoke = function insertListitem_invoke()
michael@0 37 {
michael@0 38 this.listboxNode.insertBefore(this.listitemNode,
michael@0 39 this.listboxNode.firstChild);
michael@0 40 }
michael@0 41
michael@0 42 this.finalCheck = function insertListitem_finalCheck()
michael@0 43 {
michael@0 44 var tree =
michael@0 45 { LISTBOX: [
michael@0 46 {
michael@0 47 role: ROLE_RICH_OPTION,
michael@0 48 name: "item1"
michael@0 49 },
michael@0 50 {
michael@0 51 role: ROLE_RICH_OPTION,
michael@0 52 name: "item2"
michael@0 53 },
michael@0 54 {
michael@0 55 role: ROLE_RICH_OPTION,
michael@0 56 name: "item3"
michael@0 57 },
michael@0 58 {
michael@0 59 role: ROLE_RICH_OPTION,
michael@0 60 name: "item4"
michael@0 61 }
michael@0 62 ] };
michael@0 63 testAccessibleTree(this.listboxNode, tree);
michael@0 64 }
michael@0 65
michael@0 66 this.getID = function insertListitem_getID()
michael@0 67 {
michael@0 68 return "insert listitem ";
michael@0 69 }
michael@0 70 }
michael@0 71
michael@0 72 function removeListitem(aListboxID)
michael@0 73 {
michael@0 74 this.listboxNode = getNode(aListboxID);
michael@0 75 this.listitemNode = null;
michael@0 76 this.listitem;
michael@0 77
michael@0 78 function getListitem(aThisObj)
michael@0 79 {
michael@0 80 return aThisObj.listitem;
michael@0 81 }
michael@0 82
michael@0 83 this.eventSeq = [
michael@0 84 new invokerChecker(EVENT_HIDE, getListitem, this),
michael@0 85 new invokerChecker(EVENT_REORDER, this.listboxNode)
michael@0 86 ];
michael@0 87
michael@0 88 this.invoke = function removeListitem_invoke()
michael@0 89 {
michael@0 90 this.listitemNode = this.listboxNode.firstChild;
michael@0 91 this.listitem = getAccessible(this.listitemNode);
michael@0 92
michael@0 93 this.listboxNode.removeChild(this.listitemNode);
michael@0 94 }
michael@0 95
michael@0 96 this.finalCheck = function removeListitem_finalCheck()
michael@0 97 {
michael@0 98 var tree =
michael@0 99 { LISTBOX: [
michael@0 100 {
michael@0 101 role: ROLE_RICH_OPTION,
michael@0 102 name: "item2"
michael@0 103 },
michael@0 104 {
michael@0 105 role: ROLE_RICH_OPTION,
michael@0 106 name: "item3"
michael@0 107 },
michael@0 108 {
michael@0 109 role: ROLE_RICH_OPTION,
michael@0 110 name: "item4"
michael@0 111 }
michael@0 112 ] };
michael@0 113 testAccessibleTree(this.listboxNode, tree);
michael@0 114 }
michael@0 115
michael@0 116 this.getID = function removeListitem_getID()
michael@0 117 {
michael@0 118 return "remove listitem ";
michael@0 119 }
michael@0 120 }
michael@0 121
michael@0 122 //gA11yEventDumpToConsole = true; // debug stuff
michael@0 123
michael@0 124 var gQueue = null;
michael@0 125 function doTest()
michael@0 126 {
michael@0 127 var tree =
michael@0 128 { LISTBOX: [
michael@0 129 {
michael@0 130 role: ROLE_RICH_OPTION,
michael@0 131 name: "item2"
michael@0 132 },
michael@0 133 {
michael@0 134 role: ROLE_RICH_OPTION,
michael@0 135 name: "item3"
michael@0 136 },
michael@0 137 {
michael@0 138 role: ROLE_RICH_OPTION,
michael@0 139 name: "item4"
michael@0 140 }
michael@0 141 ] };
michael@0 142 testAccessibleTree("listbox", tree);
michael@0 143
michael@0 144 gQueue = new eventQueue();
michael@0 145 gQueue.push(new insertListitem("listbox"));
michael@0 146 gQueue.push(new removeListitem("listbox"));
michael@0 147 gQueue.invoke(); // Will call SimpleTest.finish()
michael@0 148 }
michael@0 149
michael@0 150 SimpleTest.waitForExplicitFinish();
michael@0 151 addA11yLoadEvent(doTest);
michael@0 152 ]]>
michael@0 153 </script>
michael@0 154
michael@0 155 <hbox flex="1" style="overflow: auto;">
michael@0 156 <body xmlns="http://www.w3.org/1999/xhtml">
michael@0 157 <a target="_blank"
michael@0 158 href="https://bugzilla.mozilla.org/show_bug.cgi?id=656225"
michael@0 159 title="XUL listbox accessible tree doesn't get updated">
michael@0 160 Mozilla Bug 656225
michael@0 161 </a>
michael@0 162 <br/>
michael@0 163 <p id="display"></p>
michael@0 164 <div id="content" style="display: none">
michael@0 165 </div>
michael@0 166 <pre id="test">
michael@0 167 </pre>
michael@0 168 </body>
michael@0 169
michael@0 170 <vbox flex="1">
michael@0 171 <listbox id="listbox" rows="2">
michael@0 172 <listitem label="item2"/>
michael@0 173 <listitem label="item3"/>
michael@0 174 <listitem label="item4"/>
michael@0 175 </listbox>
michael@0 176 </vbox>
michael@0 177 </hbox>
michael@0 178
michael@0 179 </window>
michael@0 180

mercurial