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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
|
/* 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/. */
"use strict";
/* import-globals-from ../../mochitest/role.js */
loadScripts({ name: "role.js", dir: MOCHITESTS_DIR });
/**
* Test accessibles aren't created for linebreaks.
*/
addAccessibleTask(
`hello<br>world`,
async (browser, accDoc) => {
let doc = accDoc.nativeInterface.QueryInterface(
Ci.nsIAccessibleMacInterface
);
let docChildren = doc.getAttributeValue("AXChildren");
is(docChildren.length, 1, "The document contains a root group");
let rootGroup = docChildren[0];
let children = rootGroup.getAttributeValue("AXChildren");
is(docChildren.length, 1, "The root group contains 2 children");
// verify first child is correct
is(
children[0].getAttributeValue("AXRole"),
"AXStaticText",
"First child is a text node"
);
is(
children[0].getAttributeValue("AXValue"),
"hello",
"First child is hello text"
);
// verify second child is correct
is(
children[1].getAttributeValue("AXRole"),
"AXStaticText",
"Second child is a text node"
);
is(
children[1].getAttributeValue("AXValue"),
gIsIframe && !gIsRemoteIframe ? "world" : "world ",
"Second child is world text"
);
// we have a trailing space in here due to bug 1577028
// but this appears fixed in non-remote iframes
},
{ chrome: true, iframe: true, remoteIframe: true }
);
addAccessibleTask(
`<p id="p">hello, this is a test</p>`,
async (browser, accDoc) => {
let p = getNativeInterface(accDoc, "p");
let textLeaf = p.getAttributeValue("AXChildren")[0];
ok(textLeaf, "paragraph has a text leaf");
let str = textLeaf.getParameterizedAttributeValue(
"AXStringForRange",
NSRange(3, 6)
);
is(str, "lo, th", "AXStringForRange matches.");
let smallBounds = textLeaf.getParameterizedAttributeValue(
"AXBoundsForRange",
NSRange(3, 6)
);
let largeBounds = textLeaf.getParameterizedAttributeValue(
"AXBoundsForRange",
NSRange(3, 8)
);
ok(smallBounds.size[0] < largeBounds.size[0], "longer range is wider");
},
{ chrome: true, iframe: true, remoteIframe: true }
);
|