Skip to content

Commit d8e2694

Browse files
committed
Miscellaneous improvements to MathML DOM tests
- Don't use asynchronous test to check MathMLElement onevent attributes. closes #19500 - Only test tab-navigation of MathML links when HTML links are tab-navigable. https://github.com/mathml-refresh/mathml/issues/152 https://github.com/Igalia/chromium-dev/issues/50 https://bugzilla.mozilla.org/show_bug.cgi?id=1571487#c30
1 parent 6c1b9ea commit d8e2694

File tree

3 files changed

+17
-21
lines changed

3 files changed

+17
-21
lines changed

mathml/relations/html5-tree/clipboard-event-handlers.tentative.html

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,19 +29,15 @@
2929
"http://www.w3.org/1998/Math/MathML",
3030
"math"
3131
);
32-
async_test(test => {
33-
test.step(function() {
34-
assert_true(MathMLElement.prototype.hasOwnProperty(`on${name}`));
35-
});
36-
mathEl[`on${name}`] = test.step_func_done(e => {
37-
assert_equals(e.currentTarget, mathEl,
38-
"The event must be fired at the <math> element");
39-
});
32+
test(() => {
33+
let target = undefined;
34+
mathEl[`on${name}`] = (e) => { target = e.currentTarget; }
4035
const event = new ClipboardEvent(name, {
4136
bubbles: true,
4237
cancellable: true
4338
});
4439
mathEl.dispatchEvent(event);
40+
assert_equals(target, mathEl, "The event must be fired at the <math> element");
4541
}, `${name}: dispatching an Event at a <math> element must trigger element.on${name}`);
4642
}
4743

mathml/relations/html5-tree/math-global-event-handlers.tentative.html

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -124,23 +124,15 @@
124124
assert_equals(el[name], null, `The ${name} property must be null (remove attribute)`);
125125
}, `${name}: dynamic changes on the attribute`);
126126

127-
async_test(t => {
128-
t.step(function() {
129-
assert_true(MathMLElement.prototype.hasOwnProperty(name));
130-
});
127+
test(() => {
131128
const element = document.createElementNS(
132129
"http://www.w3.org/1998/Math/MathML",
133130
"math"
134131
);
135-
element[name] = t.step_func_done(e => {
136-
assert_equals(
137-
e.currentTarget,
138-
element,
139-
"The event must be fired at the <math> element"
140-
);
141-
});
142-
132+
let target = undefined;
133+
element[name] = (e) => { target = e.currentTarget; }
143134
element.dispatchEvent(new Event(withoutOn));
135+
assert_equals(target, element, "The event must be fired at the <math> element");
144136
}, `${name}: dispatching an Event at a <math> element must trigger element.${name}`);
145137
}
146138

mathml/relations/html5-tree/tabindex-002.html

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
<script src="/resources/testdriver.js"></script>
1111
<script src="/resources/testdriver-vendor.js"></script>
1212
<div id="log"></div>
13+
<a tabindex="1" href="#link">tabindex(1)-html</a>
1314
<math>
1415
<mtext id="text1">tabindex(omitted)</mtext>
1516
<mtext id="text2" tabindex="">tabindex(empty)</mtext>
@@ -26,14 +27,21 @@
2627
<script>
2728

2829
var i = 0,
29-
expectation = ["text11", "text8", "text9", "text10", "text7", "text5", "text6"],
30+
expectation = ["text11", "text8", "text9", "text10", "text7", "text5"],
3031
results = [],
3132
t = async_test("Elements with different tabindex must be focused sequentially when pressing 'Tab' keys");
3233

3334
setup(function () {
3435
document.body.focus();
3536
});
3637

38+
document.querySelector("a").addEventListener("focus", function (evt) {
39+
// Links are tab-navigable on that platform.
40+
expectation.push("text6");
41+
// TAB = '\ue004'
42+
test_driver.send_keys(document.body, "\ue004");
43+
}, true);
44+
3745
document.querySelector("math").addEventListener("focus", function (evt) {
3846
results.push(evt.target.id);
3947
i++;

0 commit comments

Comments
 (0)