accessible/tests/mochitest/hyperlink/hyperlink.js

Fri, 16 Jan 2015 18:13:44 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Fri, 16 Jan 2015 18:13:44 +0100
branch
TOR_BUG_9701
changeset 14
925c144e1f1f
permissions
-rw-r--r--

Integrate suggestion from review to improve consistency with existing code.

     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);
    13   this.eventSeq = [];
    14   this.unexpectedEventSeq = [];
    16   var checker = new invokerChecker(EVENT_FOCUS, this.accessible);
    17   if (aSelectedAfter)
    18     this.eventSeq.push(checker);
    19   else
    20     this.unexpectedEventSeq.push(checker);
    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);
    28     this.node.focus();
    29   }
    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   }
    38   this.getID = function focusLink_getID()
    39   {
    40     return "focus hyperlink " + prettyName(aID);
    41   }
    42 }

mercurial