haikuwebkit/LayoutTests/fast/forms/access-key-label.html

38 lines
1.2 KiB
HTML
Raw Permalink Normal View History

Implement AccessKeyLabel attribute. https://bugs.webkit.org/show_bug.cgi?id=72715 LayoutTests/imported/w3c: Reviewed by Darin Adler. * web-platform-tests/html/dom/idlharness.https-expected.txt: Source/WebCore: Spec: https://html.spec.whatwg.org/multipage/interaction.html#dom-accesskeylabel As per spec, return the modifiers+accessKey when requesting the element accessKeyLabel. Equivalent to the existing Firefox implementation and (pending) Chrome implementation. Alt is the hardcoded modifier for any non-cocoa platform, so hardcode it also for the label. Use modifier text for Mac/iOS as it can change (e.g. for voice-over). Reviewed by Darin Adler. Test: fast/forms/access-key-label.html * html/HTMLElement.cpp: (WebCore::HTMLElement::accessKeyLabel const): * html/HTMLElement.h: * html/HTMLElement.idl: Source/WTF: Reviewed by Darin Adler. Added character names for upArrow/option, as they're needed for accessKeyLabel. * wtf/unicode/CharacterNames.h: LayoutTests: Reviewed by Darin Adler. * fast/forms/access-key-label-expected.txt: Added. * fast/forms/access-key-label.html: Added. Added a test to cover accessKeyLabel scenarios. * js/dom/dom-static-property-for-in-iteration-expected.txt: * platform/gtk/imported/w3c/web-platform-tests/html/dom/idlharness.https-expected.txt: * platform/gtk/js/dom/dom-static-property-for-in-iteration-expected.txt: * platform/ios-wk2/imported/w3c/web-platform-tests/html/dom/idlharness.https-expected.txt: * platform/ios-wk2/js/dom/dom-static-property-for-in-iteration-expected.txt: * platform/mac-wk1/imported/w3c/web-platform-tests/html/dom/idlharness.https-expected.txt: * platform/mac-wk2/imported/w3c/web-platform-tests/html/dom/idlharness.https-expected.txt: * platform/mac-wk2/js/dom/dom-static-property-for-in-iteration-expected.txt: * platform/win/js/dom/dom-static-property-for-in-iteration-expected.txt: * platform/wpe/imported/w3c/web-platform-tests/html/dom/idlharness.https-expected.txt: * platform/wpe/js/dom/dom-static-property-for-in-iteration-expected.txt: HTML elements now have an accessKeyLabel property, fix expected results. Canonical link: https://commits.webkit.org/225294@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@262235 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-05-28 05:32:50 +00:00
<html>
<head>
<title>accessKeyLabel attribute</title>
<script src="../../resources/js-test-pre.js"></script>
</head>
<body>
<button id="b1" accesskey="1"></button>
<input id="i1" type="text" accessKey="e"></input>
<input id="i2" type="text" accessKey="E"></input>
<label id="l1" accessKey="a"></label>
<button id="no-access-key"></button>
<button id="empty-access-key" accesskey=""></button>
<script>
var element;
var modifiers;
if (navigator.userAgent.search(/\bMac OS X\b/) != -1)
modifiers = ["\u2303\u2325"];
else
modifiers = ["Alt+"];
function testElement(id, key) {
shouldBe(`document.getElementById("${id}").accessKeyLabel`, `modifiers + "${document.getElementById(id).accessKey}"`)
}
description("This test checks to see that accessKeyLabel attribute corresponds to the accessKey attribute");
testElement("b1")
testElement("i1")
testElement("i2")
testElement("l1")
shouldBeEqualToString("document.getElementById('no-access-key').accessKeyLabel", '');
shouldBeEqualToString("document.getElementById('empty-access-key').accessKeyLabel", '');
</script>
<p id="description"></p>
<div id="console"></div>
<script src="../../resources/js-test-post.js"></script>
</body>
</html>