mirror of
https://github.com/servo/servo.git
synced 2025-10-01 09:09:15 +01:00
Issue 12343: Add pref-gated methods and test for activatable element states
This commit is contained in:
parent
8cd4b772e9
commit
a9de84ab49
6 changed files with 98 additions and 0 deletions
|
@ -6270,6 +6270,12 @@
|
|||
"url": "/_mozilla/mozilla/MouseEvent.html"
|
||||
}
|
||||
],
|
||||
"mozilla/activation.html": [
|
||||
{
|
||||
"path": "mozilla/activation.html",
|
||||
"url": "/_mozilla/mozilla/activation.html"
|
||||
}
|
||||
],
|
||||
"mozilla/bad_cert_detected.html": [
|
||||
{
|
||||
"path": "mozilla/bad_cert_detected.html",
|
||||
|
|
3
tests/wpt/mozilla/meta/mozilla/activation.html.ini
Normal file
3
tests/wpt/mozilla/meta/mozilla/activation.html.ini
Normal file
|
@ -0,0 +1,3 @@
|
|||
[activation.html]
|
||||
type: testharness
|
||||
prefs: [dom.testing.element.activation.enabled:true]
|
52
tests/wpt/mozilla/tests/mozilla/activation.html
Normal file
52
tests/wpt/mozilla/tests/mozilla/activation.html
Normal file
|
@ -0,0 +1,52 @@
|
|||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf=8">
|
||||
<title>Test of activation state</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<a id="anchor" href="#foo">anchor</a>
|
||||
<button id="button">button</button>
|
||||
<label id="label">Label</label>
|
||||
<input type="submit" id="input" />
|
||||
|
||||
<span id="foo">foo</span>
|
||||
</body>
|
||||
|
||||
<script>
|
||||
function test_activation_state(element, selector) {
|
||||
return function () {
|
||||
element.enterFormalActivationState();
|
||||
var active = document.querySelector(selector);
|
||||
assert_true(active.id == element.id, selector + " was active");
|
||||
element.exitFormalActivationState();
|
||||
}
|
||||
}
|
||||
|
||||
test(
|
||||
test_activation_state(document.getElementById("anchor"), "a:active"),
|
||||
"Activate anchor");
|
||||
|
||||
test(
|
||||
test_activation_state(document.getElementById("button"), "button:active"),
|
||||
"Activate button");
|
||||
|
||||
test(
|
||||
test_activation_state(document.getElementById("label"), "label:active"),
|
||||
"Activate label");
|
||||
|
||||
test(
|
||||
test_activation_state(document.getElementById("input"), "input:active"),
|
||||
"Activate input");
|
||||
|
||||
test(function () {
|
||||
assert_throws(null, function () {
|
||||
var foo = document.getElementById("foo");
|
||||
foo.enterFormalActivationState();
|
||||
});
|
||||
}, "Activation invalid for span");
|
||||
</script>
|
||||
</html>
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue