accessible/tests/mochitest/name.js

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/accessible/tests/mochitest/name.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,32 @@
     1.4 +/**
     1.5 + * Test accessible name for the given accessible identifier.
     1.6 + */
     1.7 +function testName(aAccOrElmOrID, aName, aMsg)
     1.8 +{
     1.9 +  var msg = aMsg ? aMsg : "";
    1.10 +
    1.11 +  var acc = getAccessible(aAccOrElmOrID);
    1.12 +  if (!acc)
    1.13 +    return;
    1.14 +
    1.15 +  var txtID = prettyName(aAccOrElmOrID);
    1.16 +  try {
    1.17 +    is(acc.name, aName, msg + "Wrong name of the accessible for " + txtID);
    1.18 +  } catch (e) {
    1.19 +    ok(false, msg + "Can't get name of the accessible for " + txtID);
    1.20 +  }
    1.21 +  return acc;
    1.22 +}
    1.23 +
    1.24 +/**
    1.25 + * Test accessible description for the given accessible.
    1.26 + */
    1.27 +function testDescr(aAccOrElmOrID, aDescr)
    1.28 +{
    1.29 +  var acc = getAccessible(aAccOrElmOrID);
    1.30 +  if (!acc)
    1.31 +   return;
    1.32 +
    1.33 +  is(acc.description, aDescr,
    1.34 +     "Wrong description for " + prettyName(aAccOrElmOrID));
    1.35 +}

mercurial