diff -r 000000000000 -r 6474c204b198 accessible/tests/mochitest/name.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/accessible/tests/mochitest/name.js Wed Dec 31 06:09:35 2014 +0100 @@ -0,0 +1,32 @@ +/** + * Test accessible name for the given accessible identifier. + */ +function testName(aAccOrElmOrID, aName, aMsg) +{ + var msg = aMsg ? aMsg : ""; + + var acc = getAccessible(aAccOrElmOrID); + if (!acc) + return; + + var txtID = prettyName(aAccOrElmOrID); + try { + is(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)); +}