|
1 /** |
|
2 * Focus hyperlink invoker. |
|
3 * |
|
4 * @param aID [in] hyperlink identifier |
|
5 * @param aSelectedAfter [in] specifies if hyperlink is selected/focused after |
|
6 * the focus |
|
7 */ |
|
8 function focusLink(aID, aSelectedAfter) |
|
9 { |
|
10 this.node = getNode(aID); |
|
11 this.accessible = getAccessible(this.node); |
|
12 |
|
13 this.eventSeq = []; |
|
14 this.unexpectedEventSeq = []; |
|
15 |
|
16 var checker = new invokerChecker(EVENT_FOCUS, this.accessible); |
|
17 if (aSelectedAfter) |
|
18 this.eventSeq.push(checker); |
|
19 else |
|
20 this.unexpectedEventSeq.push(checker); |
|
21 |
|
22 this.invoke = function focusLink_invoke() |
|
23 { |
|
24 var expectedStates = (aSelectedAfter ? STATE_FOCUSABLE : 0); |
|
25 var unexpectedStates = (!aSelectedAfter ? STATE_FOCUSABLE : 0) | STATE_FOCUSED; |
|
26 testStates(aID, expectedStates, 0, unexpectedStates, 0); |
|
27 |
|
28 this.node.focus(); |
|
29 } |
|
30 |
|
31 this.finalCheck = function focusLink_finalCheck() |
|
32 { |
|
33 var expectedStates = (aSelectedAfter ? STATE_FOCUSABLE | STATE_FOCUSED : 0); |
|
34 var unexpectedStates = (!aSelectedAfter ? STATE_FOCUSABLE | STATE_FOCUSED : 0); |
|
35 testStates(aID, expectedStates, 0, unexpectedStates, 0); |
|
36 } |
|
37 |
|
38 this.getID = function focusLink_getID() |
|
39 { |
|
40 return "focus hyperlink " + prettyName(aID); |
|
41 } |
|
42 } |