accessible/tests/mochitest/hyperlink/hyperlink.js

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/accessible/tests/mochitest/hyperlink/hyperlink.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,42 @@
     1.4 +/**
     1.5 + * Focus hyperlink invoker.
     1.6 + *
     1.7 + * @param aID             [in] hyperlink identifier
     1.8 + * @param aSelectedAfter  [in] specifies if hyperlink is selected/focused after
     1.9 + *                          the focus
    1.10 + */
    1.11 +function focusLink(aID, aSelectedAfter)
    1.12 +{
    1.13 +  this.node = getNode(aID);
    1.14 +  this.accessible = getAccessible(this.node);
    1.15 +
    1.16 +  this.eventSeq = [];
    1.17 +  this.unexpectedEventSeq = [];
    1.18 +
    1.19 +  var checker = new invokerChecker(EVENT_FOCUS, this.accessible);
    1.20 +  if (aSelectedAfter)
    1.21 +    this.eventSeq.push(checker);
    1.22 +  else
    1.23 +    this.unexpectedEventSeq.push(checker);
    1.24 +
    1.25 +  this.invoke = function focusLink_invoke()
    1.26 +  {
    1.27 +    var expectedStates = (aSelectedAfter ? STATE_FOCUSABLE : 0);
    1.28 +    var unexpectedStates = (!aSelectedAfter ? STATE_FOCUSABLE : 0) | STATE_FOCUSED;
    1.29 +    testStates(aID, expectedStates, 0, unexpectedStates, 0);
    1.30 +
    1.31 +    this.node.focus();
    1.32 +  }
    1.33 +
    1.34 +  this.finalCheck = function focusLink_finalCheck()
    1.35 +  {
    1.36 +    var expectedStates = (aSelectedAfter ? STATE_FOCUSABLE | STATE_FOCUSED : 0);
    1.37 +    var unexpectedStates = (!aSelectedAfter ? STATE_FOCUSABLE | STATE_FOCUSED : 0);
    1.38 +    testStates(aID, expectedStates, 0, unexpectedStates, 0);
    1.39 +  }
    1.40 +
    1.41 +  this.getID = function focusLink_getID()
    1.42 +  {
    1.43 +    return "focus hyperlink " + prettyName(aID);
    1.44 +  }
    1.45 +}

mercurial