From 9e3c08db40b8916968b9f30096c7be3f00ce9647 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 21 Apr 2024 13:44:51 +0200 Subject: Adding upstream version 1:115.7.0. Signed-off-by: Daniel Baumann --- accessible/tests/mochitest/name.js | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 accessible/tests/mochitest/name.js (limited to 'accessible/tests/mochitest/name.js') diff --git a/accessible/tests/mochitest/name.js b/accessible/tests/mochitest/name.js new file mode 100644 index 0000000000..48bf2d7038 --- /dev/null +++ b/accessible/tests/mochitest/name.js @@ -0,0 +1,38 @@ +/* import-globals-from common.js */ + +/** + * 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) + ); +} -- cgit v1.2.3