B2G/gecko/accessible/tests/mochitest/text.js
/**
 * Test addSelection method.
 *
 * @param aID               [in] Id, DOM node, or acc obj
 * @param aStartOffset      [in] start offset for the new selection
 * @param aEndOffset        [in] end offset for the new selection
 * @param aSelectionsCount  [in] expected number of selections after addSelection
 */
Test addSelection method.
@param aID               [in] Id, DOM node, or acc obj
@param aStartOffset      [in] start offset for the new selection
@param aEndOffset        [in] end offset for the new selection
@param aSelectionsCount  [in] expected number of selections after addSelection
Test addSelection method . @param aID [ in ] Id DOM node or acc obj @param aStartOffset [ in ] start offset for the new selection @param aEndOffset [ in ] end offset for the new selection @param aSelectionsCount [ in ] expected number of selections after addSelection
function testTextAddSelection(aID, aStartOffset, aEndOffset, aSelectionsCount)
{
  var acc = getAccessible(aID, [nsIAccessibleText]);
  var text = acc.getText(0, -1);
  acc.addSelection(aStartOffset, aEndOffset);
  ok(acc.selectionCount, aSelectionsCount,
     text + ": failed to add selection from offset '" + aStartOffset +
     "' to offset '" + aEndOffset + "': selectionCount after");
}
function testTextAddSelection ( aID , aStartOffset , aEndOffset , aSelectionsCount ) { var acc = getAccessible ( aID , [ nsIAccessibleText ] ) ; var text = acc . getText ( 0 , - 1 ) ; acc . addSelection ( aStartOffset , aEndOffset ) ; ok ( acc . selectionCount , aSelectionsCount , text + ": failed to add selection from offset '" + aStartOffset + "' to offset '" + aEndOffset + "': selectionCount after" ) ; }
Test addSelection method.
Test addSelection method .