Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(28)

Unified Diff: third_party/WebKit/LayoutTests/imported/wpt/html/semantics/forms/form-control-infrastructure/form.html

Issue 1999243002: Import wpt@5df9b57edb3307a87d5187804b29c8ddd2aa14e1 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add expectations files (using run-webkit-tests --new-baseline) Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/LayoutTests/imported/wpt/html/semantics/forms/form-control-infrastructure/form.html
diff --git a/third_party/WebKit/LayoutTests/imported/wpt/html/semantics/forms/form-control-infrastructure/form.html b/third_party/WebKit/LayoutTests/imported/wpt/html/semantics/forms/form-control-infrastructure/form.html
index aa32560f3095fa785b652973b4ba624026e13b1b..d728dd3cd1131c87b82f0702d1fdb204f4204a62 100644
--- a/third_party/WebKit/LayoutTests/imported/wpt/html/semantics/forms/form-control-infrastructure/form.html
+++ b/third_party/WebKit/LayoutTests/imported/wpt/html/semantics/forms/form-control-infrastructure/form.html
@@ -10,37 +10,84 @@
<p><fieldset id="fieldset">fieldset</fieldset>
<p><input id="input">
<p><keygen id="keygen">
-<p><label id="label">label</label>
<p><object id="object">object</object>
<p><output id="output">output</output>
<p><select id="select"><option>select</option></select>
<p><textarea id="textarea">textarea</textarea>
+
+<!-- label is special: label.form is an alias for label.control.form -->
+<p><label id="label">label</label>
+<p><label id="label-form" form="form">label-form</label>
+<p><label id="label-form-form2" form="form2">label-form-form2</label>
+<p><label id="label-with-control">label-with-control <input></label>
+<p><label id="label-for" for="control-for-label">label-for</label> <input id="control-for-label">
+<p>
+ <input id="input-with-form-attr-in-form" form="form2">
+ <label id="label-for-control-form-in-form" for="input-with-form-attr-in-form">label-for-control-form-in-form</label>
+</p>
</form>
+<form id="form2"></form>
+<p>
+ <input id="input-with-form-attr" form="form2">
+ <label id="label-for-control-form" for="input-with-form-attr">label-for-control-form</label>
+</p>
+<!-- misnested tags where form-association is set by the HTML parser -->
+<table>
+ <form id="form3"><!-- self-closes but sets the form element pointer -->
+ <tr>
+ <td><label id="label-in-table">label-in-table</label>
+ <td><label id="label-in-table-with-control">label-in-table <input></label>
+ <td><label id="label-in-table-for" for="input-in-table">label-in-table-for</label>
+ <td><input id="input-in-table"><!-- is associated with form3 -->
+ </tr>
+ </form>
+</table>
<script>
var form;
setup(function() {
form = document.getElementById("form");
- if (!form) {
- throw new TypeError("Didn't find form");
+ form2 = document.getElementById("form2");
+ form3 = document.getElementById("form3");
+ if (!form || !form2 || !form3) {
+ throw new TypeError("Didn't find all forms");
}
});
-var reassociateableElements = [
+var listedElements = [
"button",
"fieldset",
"input",
"keygen",
- "label",
"object",
"output",
"select",
"textarea",
];
-reassociateableElements.forEach(function(localName) {
+listedElements.forEach(function(localName) {
test(function() {
- var button = document.getElementById(localName);
- assert_equals(button.form, form);
+ var control = document.getElementById(localName);
+ assert_equals(control.form, form);
}, localName + ".form");
});
+
+// label
+function testLabel(id, expected) {
+ test(function() {
+ var label = document.getElementById(id);
+ assert_equals(label.control && label.control.form, expected, 'Sanity check: label.control.form');
+ assert_equals(label.form, expected, 'label.form');
+ }, id + ".form");
+}
+
+testLabel("label", null);
+testLabel("label-form", null);
+testLabel("label-form-form2", null);
+testLabel("label-with-control", form);
+testLabel("label-for", form);
+testLabel("label-for-control-form-in-form", form2);
+testLabel("label-for-control-form", form2);
+testLabel("label-in-table", null);
+testLabel("label-in-table-with-control", form3);
+testLabel("label-in-table-for", form3);
</script>

Powered by Google App Engine
This is Rietveld 408576698