/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/** * Test retrieval of text offsets when an invalid offset is given.
*/
addAccessibleTask(
`<p id="p">test</p>`,
async function (browser, docAcc) { const p = findAccessibleChildByID(docAcc, "p");
testTextAtOffset(p, BOUNDARY_LINE_START, [[5, 5, "", 0, 0]]);
testTextBeforeOffset(p, BOUNDARY_LINE_START, [[5, 5, "", 0, 0]]);
testTextAfterOffset(p, BOUNDARY_LINE_START, [[5, 5, "", 0, 0]]);
},
{ // The old HyperTextAccessible implementation doesn't crash, but it returns // different offsets. This doesn't matter because they're invalid either // way. Since the new HyperTextAccessibleBase implementation is all we will // have soon, just test that.
chrome: true,
topLevel: true,
iframe: true,
remoteIframe: true,
}
);
/** * Test HyperText embedded object methods.
*/
addAccessibleTask(
`<div id="container">a<a id="link" href="https://example.com/">b</a>c</div>`,
async function (browser, docAcc) { const container = findAccessibleChildByID(docAcc, "container", [
nsIAccessibleHyperText,
]);
is(container.linkCount, 1, "container linkCount is 1");
let link = container.getLinkAt(0);
queryInterfaces(link, [nsIAccessible, nsIAccessibleHyperText]);
is(getAccessibleDOMNodeID(link), "link", "LinkAt 0 is the link");
is(container.getLinkIndex(link), 0, "getLinkIndex for link is 0");
is(link.startIndex, 1, "link's startIndex is 1");
is(link.endIndex, 2, "link's endIndex is 2");
is(container.getLinkIndexAtOffset(1), 0, "getLinkIndexAtOffset(1) is 0");
is(container.getLinkIndexAtOffset(0), -1, "getLinkIndexAtOffset(0) is -1");
is(link.linkCount, 0, "link linkCount is 0");
},
{
chrome: true,
topLevel: true,
iframe: true,
remoteIframe: true,
}
);
/** * Test HyperText embedded object methods near a list bullet.
*/
addAccessibleTask(
`<ul><li id="li"><a id="link" href="https://example.com/">a</a></li></ul>`,
async function (browser, docAcc) { const li = findAccessibleChildByID(docAcc, "li", [nsIAccessibleHyperText]);
let link = li.getLinkAt(0);
queryInterfaces(link, [nsIAccessible]);
is(getAccessibleDOMNodeID(link), "link", "LinkAt 0 is the link");
is(li.getLinkIndex(link), 0, "getLinkIndex for link is 0");
is(link.startIndex, 2, "link's startIndex is 2");
is(li.getLinkIndexAtOffset(2), 0, "getLinkIndexAtOffset(2) is 0");
is(li.getLinkIndexAtOffset(0), -1, "getLinkIndexAtOffset(0) is -1");
},
{
chrome: true,
topLevel: true,
iframe: true,
remoteIframe: true,
}
);
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.