1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/accessible/tests/mochitest/events/test_focus_aria_activedescendant.html Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,117 @@ 1.4 +<!DOCTYPE html> 1.5 +<html> 1.6 +<!-- 1.7 +https://bugzilla.mozilla.org/show_bug.cgi?id=429547 1.8 +--> 1.9 +<head> 1.10 + <title>aria-activedescendant focus tests</title> 1.11 + <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css" /> 1.12 + 1.13 + <script type="application/javascript" 1.14 + src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script> 1.15 + 1.16 + <script type="application/javascript" 1.17 + src="../common.js"></script> 1.18 + <script type="application/javascript" 1.19 + src="../role.js"></script> 1.20 + <script type="application/javascript" 1.21 + src="../states.js"></script> 1.22 + <script type="application/javascript" 1.23 + src="../events.js"></script> 1.24 + 1.25 + <script type="application/javascript"> 1.26 + //gA11yEventDumpToConsole = true; // debugging 1.27 + 1.28 + function changeARIAActiveDescendant(aID, aItemID) 1.29 + { 1.30 + this.eventSeq = [ 1.31 + new focusChecker(aItemID) 1.32 + ]; 1.33 + 1.34 + this.invoke = function changeARIAActiveDescendant_invoke() 1.35 + { 1.36 + getNode(aID).setAttribute("aria-activedescendant", aItemID); 1.37 + } 1.38 + 1.39 + this.getID = function changeARIAActiveDescendant_getID() 1.40 + { 1.41 + return "change aria-activedescendant on " + aItemID; 1.42 + } 1.43 + } 1.44 + 1.45 + function insertItemNFocus(aID, aNewItemID) 1.46 + { 1.47 + this.eventSeq = [ 1.48 + new invokerChecker(EVENT_SHOW, aNewItemID), 1.49 + new focusChecker(aNewItemID) 1.50 + ]; 1.51 + 1.52 + this.invoke = function insertItemNFocus_invoke() 1.53 + { 1.54 + var container = getNode(aID); 1.55 + var itemNode = document.createElement("div"); 1.56 + itemNode.setAttribute("id", aNewItemID); 1.57 + itemNode.textContent = "item3"; 1.58 + container.appendChild(itemNode); 1.59 + 1.60 + container.setAttribute("aria-activedescendant", aNewItemID); 1.61 + } 1.62 + 1.63 + this.getID = function insertItemNFocus_getID() 1.64 + { 1.65 + return "insert new node and focus it with ID: " + aNewItemID; 1.66 + } 1.67 + } 1.68 + 1.69 + var gQueue = null; 1.70 + function doTest() 1.71 + { 1.72 + gQueue = new eventQueue(); 1.73 + 1.74 + gQueue.push(new synthFocus("container", new focusChecker("item1"))); 1.75 + gQueue.push(new changeARIAActiveDescendant("container", "item2")); 1.76 + 1.77 + gQueue.push(new synthFocus("combobox_entry", new focusChecker("combobox_entry"))); 1.78 + gQueue.push(new changeARIAActiveDescendant("combobox", "combobox_option2")); 1.79 + 1.80 + todo(false, "No focus for inserted element, bug 687011"); 1.81 + //gQueue.push(new insertItemNFocus("container", "item3")); 1.82 + 1.83 + gQueue.invoke(); // Will call SimpleTest.finish(); 1.84 + } 1.85 + 1.86 + SimpleTest.waitForExplicitFinish(); 1.87 + addA11yLoadEvent(doTest); 1.88 + </script> 1.89 +</head> 1.90 +<body> 1.91 + 1.92 + <a target="_blank" 1.93 + href="https://bugzilla.mozilla.org/show_bug.cgi?id=429547" 1.94 + title="Support aria-activedescendant usage in nsIAccesible::TakeFocus()"> 1.95 + Mozilla Bug 429547 1.96 + </a> 1.97 + <a target="_blank" 1.98 + href="https://bugzilla.mozilla.org/show_bug.cgi?id=761102" 1.99 + title="Focus may be missed when ARIA active-descendant is changed on active composite widget"> 1.100 + Mozilla Bug 761102 1.101 + </a> 1.102 + <p id="display"></p> 1.103 + <div id="content" style="display: none"></div> 1.104 + <pre id="test"> 1.105 + </pre> 1.106 + 1.107 + <div role="listbox" aria-activedescendant="item1" id="container" tabindex="1"> 1.108 + <div role="listitem" id="item1">item1</div> 1.109 + <div role="listitem" id="item2">item2</div> 1.110 + </div> 1.111 + 1.112 + <div role="combobox" id="combobox"> 1.113 + <input id="combobox_entry"> 1.114 + <ul> 1.115 + <li role="option" id="combobox_option1">option1</li> 1.116 + <li role="option" id="combobox_option2">option2</li> 1.117 + </ul> 1.118 + </div> 1.119 +</body> 1.120 +</html>