B2G/gecko/accessible/tests/mochitest/attributes.js
/**
 * Test default text attributes.
 *
 * @param aID                   [in] the ID of DOM element having text
 *                              accessible
 * @param aDefAttrs             [in] the map of expected text attributes
 *                              (name/value pairs)
 * @param aSkipUnexpectedAttrs  [in] points the function doesn't fail if
 *                              unexpected attribute is encountered
 */
Test default text attributes.
@param aID                   [in] the ID of DOM element having text
accessible
@param aDefAttrs             [in] the map of expected text attributes
(name/value pairs)
@param aSkipUnexpectedAttrs  [in] points the function doesn't fail if
unexpected attribute is encountered
Test default text attributes . @param aID [ in ] the ID of DOM element having text accessible @param aDefAttrs [ in ] the map of expected text attributes ( name / value pairs ) @param aSkipUnexpectedAttrs [ in ] points the function doesn ' t fail if unexpected attribute is encountered
function testDefaultTextAttrs(aID, aDefAttrs, aSkipUnexpectedAttrs)
{
  var accessible = getAccessible(aID, [nsIAccessibleText]);
  if (!accessible)
    return;
  var defAttrs = null;
  try{
    defAttrs = accessible.defaultTextAttributes;
  } catch (e) {
  }
  if (!defAttrs) {
    ok(false, "Can't get default text attributes for " + aID);
    return;
  }
  var errorMsg = ". Getting default text attributes for " + aID;
  compareAttrs(errorMsg, defAttrs, aDefAttrs, aSkipUnexpectedAttrs);
}
function testDefaultTextAttrs ( aID , aDefAttrs , aSkipUnexpectedAttrs ) { var accessible = getAccessible ( aID , [ nsIAccessibleText ] ) ; if ( ! accessible ) return ; var defAttrs = null ; try { defAttrs = accessible . defaultTextAttributes ; } catch ( e ) { } if ( ! defAttrs ) { ok ( false , "Can't get default text attributes for " + aID ) ; return ; } var errorMsg = ". Getting default text attributes for " + aID ; compareAttrs ( errorMsg , defAttrs , aDefAttrs , aSkipUnexpectedAttrs ) ; }
Test default text attributes.
Test default text attributes .