mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 562932 - [Test Part] "Implement control attribute for label element" [r=sicking]
This commit is contained in:
parent
6b57ca1497
commit
ec44e2fb46
@ -176,6 +176,7 @@ _TEST_FILES = test_bug589.html \
|
||||
test_bug546995-5.html \
|
||||
file_bug546995.html \
|
||||
test_bug377624.html \
|
||||
test_bug562932.html \
|
||||
$(NULL)
|
||||
|
||||
libs:: $(_TEST_FILES)
|
||||
|
112
content/html/content/test/test_bug562932.html
Normal file
112
content/html/content/test/test_bug562932.html
Normal file
@ -0,0 +1,112 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=562932
|
||||
-->
|
||||
<head>
|
||||
<title>Test for Bug 562932</title>
|
||||
<script type="application/javascript" src="/MochiKit/packed.js"></script>
|
||||
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
||||
</head>
|
||||
<body>
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=562932">Mozilla Bug 562932</a>
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: none">
|
||||
<!-- No @for, we have to check the content -->
|
||||
<label id='l1'><input id='i1'></label>
|
||||
<label id='l2'><input id='i2'><input></label>
|
||||
<label id='l3'></label>
|
||||
<label id='l4a'><fieldset id='f'>foo</fieldset></label>
|
||||
<label id='l4b'><label id='l4c'><input id='i3'></label></label>
|
||||
<label id='l4d'><label id='l4e'><input id='i3b'></label><input></label>
|
||||
|
||||
<!-- With @for, we do no check the content -->
|
||||
<label id='l5' for='i1'></label>
|
||||
<label id='l6' for='i4'></label>
|
||||
<label id='l7' for='i4'><input></label>
|
||||
<label id='l8' for='i1 i2'></label>
|
||||
<label id='l9' for='i1 i2'><input></label>
|
||||
<label id='l10' for='f'></label>
|
||||
<label id='l11' for='i4'></label>
|
||||
<label id='l12' for='i5'></label>
|
||||
<label id='l13' for=''><input></label>
|
||||
<!-- <label id='l14'> is created in script -->
|
||||
</div>
|
||||
<pre id="test">
|
||||
<script type="application/javascript">
|
||||
|
||||
/** Test for Bug 562932 **/
|
||||
|
||||
// Check if we are using the html5 parser
|
||||
// because some tests will fail otherwise.
|
||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
||||
var gHtml5Parser = Components.classes["@mozilla.org/preferences-service;1"]
|
||||
.getService(Components.interfaces.nsIPrefBranch)
|
||||
.getBoolPref("html5.enable");
|
||||
|
||||
function checkControl(aLabelId, aElementId, aMsg)
|
||||
{
|
||||
var element = null;
|
||||
|
||||
if (aElementId != null) {
|
||||
element = document.getElementById(aElementId);
|
||||
}
|
||||
|
||||
is(document.getElementById(aLabelId).control, element, aMsg);
|
||||
}
|
||||
|
||||
ok('control' in document.createElement('label'),
|
||||
"label element should have a control IDL attribute");
|
||||
|
||||
checkControl('l1', 'i1', "label control should be the first form element");
|
||||
checkControl('l2', 'i2', "label control should be the first form element");
|
||||
checkControl('l3', null, "label control should be null when there is no child");
|
||||
checkControl('l4a', null, "label control should be null when there is no \
|
||||
labelable form element child");
|
||||
if (gHtml5Parser) {
|
||||
checkControl('l4b', 'i3', "label control should be the first labelable element \
|
||||
in tree order");
|
||||
}
|
||||
checkControl('l4c', 'i3', "label control should be the first labelable element \
|
||||
in tree order");
|
||||
if (gHtml5Parser) {
|
||||
checkControl('l4d', 'i3b', "label control should be the first labelable element \
|
||||
in tree order");
|
||||
}
|
||||
checkControl('l4e', 'i3b', "label control should be the first labelable element \
|
||||
in tree order");
|
||||
checkControl('l5', 'i1', "label control should be the id in @for");
|
||||
checkControl('l6', null,
|
||||
"label control should be null if the id in @for is not valid");
|
||||
checkControl('l7', null,
|
||||
"label control should be null if the id in @for is not valid");
|
||||
checkControl('l8', null,
|
||||
"label control should be null if there are more than one id in @for");
|
||||
checkControl('l9', null,
|
||||
"label control should be null if there are more than one id in @for");
|
||||
checkControl('l10', null, "label control should be null if the id in @for \
|
||||
is not an id from a labelable form element");
|
||||
|
||||
var inputOutOfDocument = document.createElement('input');
|
||||
inputOutOfDocument.id = 'i4';
|
||||
checkControl('l11', null, "label control should be null if the id in @for \
|
||||
is not an id from an element in the document");
|
||||
|
||||
var inputInDocument = document.createElement('input');
|
||||
inputInDocument.id = 'i5';
|
||||
document.getElementById('content').appendChild(inputInDocument);
|
||||
checkControl('l12', 'i5', "label control should be the id in @for");
|
||||
|
||||
checkControl('l13', null, "label control should be null if the id in @for \
|
||||
is empty");
|
||||
|
||||
var labelOutOfDocument = document.createElement('label');
|
||||
labelOutOfDocument.htmlFor = 'i1';
|
||||
is(labelOutOfDocument.control, null, "out of document label shouldn't \
|
||||
labelize a form control");
|
||||
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in New Issue
Block a user