summaryrefslogtreecommitdiffstats
path: root/accessible/tests/mochitest/name.js
blob: 8d82909058a5984978184940f15993e339d0a163 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
/**
 * Test accessible name for the given accessible identifier.
 */
function testName(aAccOrElmOrID, aName, aMsg, aTodo)
{
  var msg = aMsg ? aMsg : "";

  var acc = getAccessible(aAccOrElmOrID);
  if (!acc)
    return;

  var func = aTodo ? todo_is : is;
  var txtID = prettyName(aAccOrElmOrID);
  try {
    func(acc.name, aName, msg + "Wrong name of the accessible for " + txtID);
  } catch (e) {
    ok(false, msg + "Can't get name of the accessible for " + txtID);
  }
  return acc;
}

/**
 * Test accessible description for the given accessible.
 */
function testDescr(aAccOrElmOrID, aDescr)
{
  var acc = getAccessible(aAccOrElmOrID);
  if (!acc)
   return;

  is(acc.description, aDescr,
     "Wrong description for " + prettyName(aAccOrElmOrID));
}