Bug 1617610 [wpt PR 21932] - Implement dirname support for form element, a=testonly

Automatic update from web-platform-tests
Implement dirname for form submit and directionality for element

--
Move dirname collection to input

--
Rearrange directionality algorithm functions

--
Simplify node#parent_directionality

--

wpt-commits: e5321c5c1123b419f9c871bee7c13354b60ab911, 4bd794f7c273788e8a8842ca3c5ee3fd0d9b13b3, cee8a3e8b1b97e6cc1ae61c4625544cbf737ff99, 0350340c01766a08efd65abba28ffeff64862842
wpt-pr: 21932
This commit is contained in:
Dmitry Kolupaev 2020-02-26 10:40:34 +00:00 коммит произвёл moz-wptsync-bot
Родитель d9908aa1b9
Коммит 4aa7dcd566
3 изменённых файлов: 84 добавлений и 2 удалений

Просмотреть файл

@ -20,10 +20,17 @@
}
var t = async_test("submit element directionality");
document.querySelector("input").value="foobar";
document.querySelector("input").value = "foobar";
document.querySelector("button").click();
document.querySelector("iframe").onload = t.step_func_done(function() {
var iframe = document.querySelector("iframe");
iframe.onload = t.step_func(function() {
// The initial about:blank load event can be fired before the form navigation occurs.
// See https://github.com/whatwg/html/issues/490 for more information.
if(iframe.contentWindow.location.href == "about:blank") { return; }
assert_equals(getParameterByName("comment.dir"), "ltr");
t.done();
});
</script>

Просмотреть файл

@ -0,0 +1,37 @@
<!DOCTYPE html>
<meta charset=utf-8>
<title>Submitting element directionality: the dirname attribute</title>
<link rel="author" title="Denis Ah-Kang" href="mailto:denis@w3.org">
<link rel=help href="https://html.spec.whatwg.org/multipage/#submitting-element-directionality:-the-dirname-attribute">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id="log"></div>
<form action="dirname-ltr-iframe.html" method=get target="iframe">
<p><label>Comment: <input type=text name="comment" dir="auto" dirname="comment.dir" required/></label></p>
<p><button type=submit>Post Comment</button></p>
</form>
<iframe name="iframe"></iframe>
<script>
function getParameterByName(name) {
name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]");
var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"),
results = regex.exec(document.querySelector("iframe").contentWindow.location.search);
return results == null ? "" : decodeURIComponent(results[1].replace(/\+/g, " "));
}
var t = async_test("submit element directionality");
var rtlValue = "مرحبا";
document.querySelector("input").value = rtlValue;
document.querySelector("button").click();
var iframe = document.querySelector("iframe");
iframe.onload = t.step_func(function() {
// The initial about:blank load event can be fired before the form navigation occurs.
// See https://github.com/whatwg/html/issues/490 for more information.
if(iframe.contentWindow.location.href == "about:blank") { return; }
assert_equals(getParameterByName("comment.dir"), "rtl");
t.done();
});
</script>

Просмотреть файл

@ -0,0 +1,38 @@
<!DOCTYPE html>
<meta charset=utf-8>
<title>Submitting element directionality: the dirname attribute</title>
<link rel="author" title="Kolupaev Dmitry" href="mailto:dmitry.klpv@gmail.com">
<link rel=help href="https://html.spec.whatwg.org/multipage/#submitting-element-directionality:-the-dirname-attribute">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id="log"></div>
<div dir="rtl">
<form action="dirname-ltr-iframe.html" method=get target="iframe">
<p><label>Comment: <input type=text name="comment" dirname="comment.dir" required/></label></p>
<p><button type=submit>Post Comment</button></p>
</form>
</div>
<iframe name="iframe"></iframe>
<script>
function getParameterByName(name) {
name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]");
var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"),
results = regex.exec(document.querySelector("iframe").contentWindow.location.search);
return results == null ? "" : decodeURIComponent(results[1].replace(/\+/g, " "));
}
var t = async_test("submit element directionality");
document.querySelector("input").value = "foobar";
document.querySelector("button").click();
var iframe = document.querySelector("iframe");
iframe.onload = t.step_func(function() {
// The initial about:blank load event can be fired before the form navigation occurs.
// See https://github.com/whatwg/html/issues/490 for more information.
if(iframe.contentWindow.location.href == "about:blank") { return; }
assert_equals(getParameterByName("comment.dir"), "rtl");
t.done();
});
</script>