Update web-platform-tests to revision 0d318188757a9c996e20b82db201fd04de5aa255

This commit is contained in:
James Graham 2015-03-27 09:15:38 +00:00
parent b2a5225831
commit 1a81b18b9f
12321 changed files with 544385 additions and 6 deletions

View file

@ -0,0 +1,43 @@
<!DOCTYPE html>
<meta charset=utf-8>
<title>Selector: pseudo-classes (:checked)</title>
<link rel="author" title="Denis Ah-Kang" href="mailto:denis@w3.org" id=link1>
<link rel=help href="https://html.spec.whatwg.org/multipage/#pseudo-classes" id=link2>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="utils.js"></script>
<div id="log"></div>
<select id=select1>
<optgroup label="options" id=optgroup1>
<option value="option1" id=option1 selected>option1
<option value="option2" id=option2>option2
<option value="option2" id=option3 checked>option3
</select>
<input type=checkbox id=checkbox1 checked>
<input type=checkbox id=checkbox2>
<input type=checkbox id=checkbox3 selected>
<input type=radio id=radio1 checked>
<input type=radio id=radio2>
<form>
<p><input type=submit contextmenu=formmenu id="submitbutton"></p>
<menu type=popup id=formmenu>
<menuitem type=checkbox checked default id=menuitem1>
<menuitem type=checkbox default id=menuitem2>
<menuitem type=checkbox id=menuitem3>
<menuitem type=radio checked id=menuitem4>
<menuitem type=radio id=menuitem5>
</menu>
</form>
<script>
testSelector(":checked", ["option1", "checkbox1", "radio1", "menuitem1", "menuitem4"], "':checked' matches checked <input>/<menuitem> in checkbox and radio button states, selected <option>s");
document.getElementById("checkbox1").removeAttribute("type"); // change type of input
document.getElementById("radio1").removeAttribute("type"); // change type of input
testSelector(":checked", ["option1", "menuitem1", "menuitem4"], "':checked' should no longer match <input>s whose type checkbox/radio has been removed");
document.getElementById("option2").selected = "selected"; // select option2
document.getElementById("checkbox2").click(); // check chekbox2
document.getElementById("radio2").click(); // check radio2
testSelector(":checked", ["option2", "checkbox2", "radio2", "menuitem1", "menuitem4"], "':checked' matches clicked checkbox and radio buttons");
</script>

View file

@ -0,0 +1,61 @@
<!DOCTYPE html>
<meta charset=utf-8>
<title>Selector: pseudo-classes (:default)</title>
<link rel="author" title="Denis Ah-Kang" href="mailto:denis@w3.org" id=link1>
<link rel=help href="https://html.spec.whatwg.org/multipage/#pseudo-classes" id=link2>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="utils.js"></script>
<div id="log"></div>
<form>
<button id=button1 type=button>button1</button>
<button id=button2 type=submit>button2</button>
</form>
<form>
<button id=button3 type=reset>button3</button>
<button id=button4>button4</button>
</form>
<button id=button5 type=submit>button5</button>
<form id=form1>
<input type=text id=input1>
</form>
<input type=text id=input2 form=form1>
<form>
<input type=submit id=input3>
<input type=submit id=input4>
</form>
<form>
<input type=image id=input5>
<input type=image id=input6>
</form>
<form>
<input type=submit id=input7>
</form>
<input type=checkbox id=checkbox1 checked>
<input type=checkbox id=checkbox2>
<input type=checkbox id=checkbox3 default>
<select id=select1>
<optgroup label="options" id=optgroup1>
<option value="option1" id=option1 selected>option1
<option value="option1" id=option1>option1
</select>
<dialog id="dialog">
<input type=submit id=input8>
</dialog>
<form>
<button id=button6 type='invalid'>button6</button>
<button id=button7>button7</button>
</form>
<form>
<button id=button8>button8</button>
<button id=button9>button9</button>
</form>
<script>
testSelector(":default", ["button2", "button4", "input3", "input5", "input7", "checkbox1", "option1", "button6", "button8"], "':default' matches <button>s that are their form's default button, <input>s of type submit/image that are their form's default button, checked <input>s and selected <option>s");
document.getElementById("button1").type = "submit"; // change the form's default button
testSelector(":default", ["button1", "button4", "input3", "input5", "input7", "checkbox1", "option1", "button6", "button8"], "':default' matches dynamically changed form's default buttons");
</script>

View file

@ -0,0 +1,36 @@
<!DOCTYPE html>
<meta charset=utf-8 id=meta>
<title id=title>Selector: pseudo-classes (:dir(ltr), :dir(rtl))</title>
<link rel="author" title="Denis Ah-Kang" href="mailto:denis@w3.org" id=link1>
<link rel=help href="https://html.spec.whatwg.org/multipage/#pseudo-classes" id=link2>
<script src="/resources/testharness.js" id=script1></script>
<script src="/resources/testharnessreport.js" id=script2></script>
<script src="utils.js" id=script3></script>
<style id=style>
#span1 {direction: rtl;}
#span5, #span6 {display: none;}
</style>
<div id="log"></div>
<bdo dir="rtl" id=bdo1>WERBEH</bdo>
<bdo dir="ltr" id=bdo2>HEBREW</bdo>
<bdi id=bdi1>HEBREW</bdi>
<bdi dir="rtl" id=bdi2>WERBEH</bdi>
<bdi dir="ltr" id=bdi3>HEBREW</bdi>
<span id=span1>WERBEH</span>
<span dir="rtl" id=span2>WERBEH</span>
<span dir="ltr" id=span3>HEBREW</span>
&#x202E;<span id=span4>WERBEH</span>&#x202C;
<span dir="rtl" id=span5>WERBEH</span>
<span dir="ltr" id=span6>HEBREW</span>
<bdo dir="auto" id=bdo3>HEBREW</bdo>
<bdo dir="auto" id=bdo4>إيان</bdo>
<bdo dir="ltr" id=bdo5>עברית</bdo>
<script>
testSelector(":dir(rtl)", ["bdo1", "bdi2", "span1", "span2", "span4", "span5", "bdo4"], "':dir(rtl)' matches all elements whose directionality is 'rtl'.");
testSelector(":dir(ltr)", ["html", "head", "body", "meta", "title", "link1", "link2", "script1", "script2", "script3", "stlyle", "log", "bdo2", "bdi3", "span3", "span6", "bdo3", "bdo5"], "':dir(ltr)' matches all elements whose directionality is 'ltr'.");
var bdo = document.createElement("bdo");
bdo.setAttribute("dir", "ltr");
testSelector(":dir(ltr)", ["meta", "title", "link1", "link2", "script1", "script2", "script3", "stlyle", "log", "bdo2", "bdi3", "span3", "span6", "bdo3"], "':dir(ltr)' doesn't match elements not in the document.");
</script>

View file

@ -0,0 +1,18 @@
<!DOCTYPE html>
<meta charset=iso-8859-8 id=meta>
<title id=title>Selector: pseudo-classes (:dir(ltr), :dir(rtl)) in iso-8859-8 documents</title>
<link rel="author" title="Denis Ah-Kang" href="mailto:denis@w3.org" id=link1>
<link rel=help href="https://html.spec.whatwg.org/multipage/#pseudo-classes" id=link2>
<script src="/resources/testharness.js" id=script1></script>
<script src="/resources/testharnessreport.js" id=script2></script>
<script src="utils.js" id=script3></script>
<div id="log"></div>
<div>This text is left to right<div id=div1 style="direction:rtl">this is right to left</div></div>
<div>This text is left to right<span id=div2 style="direction:rtl">this is left to right</span></div>
<script>
var ltr = new Array(),
all = document.querySelectorAll('*');
for(var i = all.length; i--; ltr.unshift(all[i]));
testSelector(":dir(ltr)", ltr, "direction doesn't affect :dir()");
</script>

View file

@ -0,0 +1,57 @@
<!DOCTYPE html>
<meta charset=utf-8>
<title>Selector: pseudo-classes (:disabled)</title>
<link rel="author" title="Denis Ah-Kang" href="mailto:denis@w3.org" id=link1>
<link rel=help href="https://html.spec.whatwg.org/multipage/#pseudo-classes" id=link2>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="utils.js"></script>
<style>
#input4 {display:none;}
</style>
<div id="log"></div>
<button id=button1 type=submit>button1</button>
<button id=button2 disabled>button2</button>
<input id=input1>
<input id=input2 disabled>
<input id=input3 readonly>
<input id=input4>
<select id=select1>
<optgroup label="options" id=optgroup1>
<option value="option1" id=option1 selected>option1
</select>
<select disabled id=select2>
<optgroup label="options" disabled id=optgroup2>
<option value="option2" disabled id=option2>option2
</select>
<textarea id=textarea1>textarea1</textarea>
<textarea disabled id=textarea2>textarea2</textarea>
<fieldset id=fieldset1></fieldset>
<fieldset disabled id=fieldset2>
<legend><input type=checkbox id=club></legend>
<p><label>Name on card: <input id=clubname required></label></p>
<p><label>Card number: <input id=clubnum required pattern="[-0-9]+"></label></p>
</fieldset>
<label disabled></label>
<object disabled></object>
<output disabled></output>
<img disabled/>
<meter disabled></meter>
<progress disabled></progress>
<script>
testSelector(":disabled", ["button2", "input2", "select2", "optgroup2", "option2", "textarea2", "fieldset2", "clubname", "clubnum"], "':disabled' should match only disabled elements");
document.getElementById("button2").removeAttribute("disabled");
testSelector(":disabled", ["input2", "select2", "optgroup2", "option2", "textarea2", "fieldset2", "clubname", "clubnum"], "':disabled' should not match elements whose disabled attribute has been removed");
document.getElementById("button1").setAttribute("disabled", "disabled");
testSelector(":disabled", ["button1", "input2", "select2", "optgroup2", "option2", "textarea2", "fieldset2", "clubname", "clubnum"], "':disabled' should also match elements whose disabled attribute has been set");
document.getElementById("input2").setAttribute("type", "submit"); // change input type to submit
testSelector(":disabled", ["button1", "input2", "select2", "optgroup2", "option2", "textarea2", "fieldset2", "clubname", "clubnum"], "':disabled' should also match disabled elements whose type has changed");
var input = document.createElement("input");
input.setAttribute("disabled", "disabled");
testSelector(":disabled", ["button1", "input2", "select2", "optgroup2", "option2", "textarea2", "fieldset2", "clubname", "clubnum"], "':disabled' should not match elements not in the document");
</script>

View file

@ -0,0 +1,42 @@
<!DOCTYPE html>
<meta charset=utf-8>
<title>Selector: pseudo-classes (:enabled)</title>
<link rel="author" title="Denis Ah-Kang" href="mailto:denis@w3.org" id=link1>
<link rel=help href="https://html.spec.whatwg.org/multipage/#pseudo-classes" id=link2>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="utils.js"></script>
<div id="log"></div>
<a id=link3></a>
<area id=link4></area>
<link id=link5></link>
<a href="http://www.w3.org" id=link6></a>
<area href="http://www.w3.org" id=link7></area>
<link href="http://www.w3.org" id=link8></link>
<button id=button1>button1</button>
<button id=button2 disabled>button2</button>
<input id=input1>
<input id=input2 disabled>
<select id=select1>
<optgroup label="options" id=optgroup1>
<option value="option1" id=option1 selected>option1
</select>
<select disabled id=select2>
<optgroup label="options" disabled id=optgroup2>
<option value="option2" disabled id=option2>option2
</select>
<textarea id=textarea1>textarea1</textarea>
<textarea disabled id=textarea2>textarea2</textarea>
<form>
<p><input type=submit contextmenu=formmenu id=submitbutton></p>
<menu type=popup id=formmenu>
<menuitem command="submitbutton" default id=menuitem1>
<menuitem command="resetbutton" disabled id=menuitem2>
</menu>
</form>
<fieldset id=fieldset1></fieldset>
<fieldset disabled id=fieldset2></fieldset>
<script>
testSelector(":enabled", ["button1", "input1", "select1", "optgroup1", "option1", "textarea1", "submitbutton", "menuitem1", "fieldset1"], "':enabled' elements that are not disabled");
</script>

View file

@ -0,0 +1,5 @@
<!DOCTYPE html>
<meta charset=utf-8>
<title>Selector: pseudo-classes (:focus)</title>
<link rel="author" title="Denis Ah-Kang" href="mailto:denis@w3.org">
<input id="inputiframe" type=text value="foobar" />

View file

@ -0,0 +1,42 @@
<!DOCTYPE html>
<meta charset=utf-8>
<title>Selector: pseudo-classes (:focus)</title>
<link rel="author" title="Denis Ah-Kang" href="mailto:denis@w3.org" id=link1>
<link rel=help href="https://html.spec.whatwg.org/multipage/#pseudo-classes" id=link2>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="utils.js"></script>
<body id=body tabindex=0>
<div id="log"></div>
<button id=button1 type=submit>button1</button>
<input id=input1>
<input id=input2 disabled>
<input id=input3 autofocus>
<textarea id=textarea1>textarea1</textarea>
<input type=checkbox id=checkbox1 checked>
<input type=radio id=radio1 checked>
<div tabindex=0 id=div1>hello</div>
<div contenteditable id=div2>content</div>
<iframe src="focus-iframe.html" id=iframe onload="load()"></iframe>
<script>
testSelector(":focus", ["input3"], "input3 has the attribute autofocus");
document.getElementById("input1").focus(); // set the focus on input1
testSelector(":focus", ["input1"], "input1 has the focus");
document.getElementById("div1").focus();
testSelector(":focus", ["div1"], "tabindex attribute makes the element focusable");
document.getElementById("div2").focus();
testSelector(":focus", ["div2"], "editable elements are focusable");
function load() {
document.getElementById("iframe").contentDocument.getElementById("inputiframe").focus();
testSelector(":focus", [], "':focus' doesn't match focused elements in iframe");
}
document.body.focus();
testSelector(":focus", ["body"], "':focus' matches focussed body with tabindex");
</script>
</body>

View file

@ -0,0 +1,37 @@
<!DOCTYPE html>
<meta charset=utf-8>
<title>Selector: pseudo-classes (:indeterminate)</title>
<link rel="author" title="Denis Ah-Kang" href="mailto:denis@w3.org" id=link1>
<link rel=help href="https://html.spec.whatwg.org/multipage/#pseudo-classes" id=link2>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="utils.js"></script>
<div id="log"></div>
<input type=checkbox id=checkbox1>
<input type=checkbox id=checkbox2>
<input type=radio id=radio1 checked>
<input type=radio name=radiogroup id=radio2>
<input type=radio name=radiogroup id=radio3>
<input type=radio name=group2 id=radio4>
<input type=radio name=group2 id=radio5>
<progress id="progress1"></progress>
<progress id="progress2" value=10></progress>
<script>
testSelector(":indeterminate", ["radio2", "radio3", "radio4", "radio5", "progress1"], "':progress' matches <input>s radio buttons whose radio button group contains no checked input and <progress> elements without value attribute");
document.getElementById("radio2").setAttribute("checked", "checked");
testSelector(":indeterminate", ["radio4", "radio5", "progress1"], "dynamically check a radio input in a radio button group");
document.getElementById("radio4").click();
testSelector(":indeterminate", ["checkbox1", "progress2"], "click on radio4 which is in the indeterminate state");
document.getElementById("progress1").setAttribute("value", "20");
testSelector(":indeterminate", [], "adding a value to progress1 should put it in a determinate state");
document.getElementById("progress2").removeAttribute("value");
testSelector(":indeterminate", ["progress2"], "removing progress2's value should put it in an indeterminate state");
document.getElementById("checkbox1").indeterminate = true; // set checkbox1 in the indeterminate state
testSelector(":indeterminate", ["checkbox1", "progress2"], "':progress' also matches <input> checkbox whose indeterminate IDL is set to true");
</script>

View file

@ -0,0 +1,27 @@
<!DOCTYPE html>
<meta charset=utf-8>
<title>Selector: pseudo-classes (:in-range, :out-of-range)</title>
<link rel="author" title="Denis Ah-Kang" href="mailto:denis@w3.org" id=link1>
<link rel=help href="https://html.spec.whatwg.org/multipage/#pseudo-classes" id=link2>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="utils.js"></script>
<div id="log"></div>
<input type=number value=0 min=0 max=10 id=number1>
<input type=number value=0 min=0 max=10 id=number2 disabled>
<input type=number value=0 min=1 max=10 id=number3>
<input type=number value=11 min=0 max=10 id=number4>
<script>
testSelector(":in-range", ["number1"], "':in-range' matches all elements that are candidates for constraint validation, have range limitations, and that are neither suffering from an underflow nor suffering from an overflow");
testSelector(":out-of-range", ["number3", "number4"], "':out-of-range' matches all elements that are candidates for constraint validation, have range limitations, and that are either suffering from an underflow or suffering from an overflow");
document.getElementById("number1").value = -10;
testSelector(":in-range", [], "':in-range' update number1's value < min");
testSelector(":out-of-range", ["number1", "number3", "number4"], "':out-of-range' update number1's value < min");
document.getElementById("number3").min = 0;
testSelector(":in-range", ["number3"], "':in-range' update number3's min < value");
testSelector(":out-of-range", ["number1", "number4"], "':out-of-range' update number3's min < value");
</script>

View file

@ -0,0 +1,24 @@
<!DOCTYPE html>
<meta charset=utf-8>
<title>Selector: pseudo-classes (:link)</title>
<link rel="author" title="Denis Ah-Kang" href="mailto:denis@w3.org" id=link1>
<link rel=help href="https://html.spec.whatwg.org/multipage/#pseudo-classes" id=link2>
<link rel=stylesheet href="/resources/testharness.css" id=link3>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="utils.js"></script>
<div id="log"></div>
<a id=link4></a>
<area id=link5></area>
<link id=link6></link>
<a href="http://www.w3.org" id=link7></a>
<area href="http://www.w3.org" id=link8></area>
<link href="http://www.w3.org" id=link9></link>
<a href="http://[" id=link10></a>
<script>
testSelector(":link", ["link1", "link2", "link3", "link7", "link8", "link9", "link10"], "Only <a>s, <area>s and <link>s that have a href attribute match ':link'");
document.getElementById("link9").removeAttribute("href");
testSelector(":link", ["link1", "link2", "link3", "link7", "link8", "link10"], "':link' doesn't match elements whos href attribute has been removed");
</script>

View file

@ -0,0 +1,71 @@
<!DOCTYPE html>
<meta charset=utf-8>
<title>Selector: pseudo-classes (:read-write, :read-only)</title>
<link rel=help href="https://html.spec.whatwg.org/multipage/#pseudo-classes" id=link2>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="utils.js"></script>
<div id="log"></div>
<div id=set1>
<input id=input1>
<input id=input2 readonly>
<input id=input3 disabled>
<input id=input4 type=checkbox>
<input id=input5 type=checkbox readonly>
</div>
<div id=set2>
<textarea id=textarea1>textarea1</textarea>
<textarea readonly id=textarea2>textarea2</textarea>
</div>
<div id=set3>
<textarea id=textarea3>textarea3</textarea>
<textarea disabled id=textarea4>textarea4</textarea>
</div>
<div id=set4>
<p id=p1>paragraph1.</p>
<p id=p2 contenteditable>paragraph2.</p>
</div>
<script>
testSelector("#set1 :read-write", ["input1"], "The :read-write pseudo-class must match input elements to which the readonly attribute applies, and that are mutable");
testSelector("#set1 :read-only", ["input2"], "The :read-only pseudo-class must not match input elements to which the readonly attribute applies, and that are mutable");
document.getElementById("input1").setAttribute("readonly", "readonly");
testSelector("#set1 :read-write", [], "The :read-write pseudo-class must not match input elements after the readonly attribute has been added");
testSelector("#set1 :read-only", ["input1", "input2"], "The :read-only pseudo-class must match input elements after the readonly attribute has been added");
document.getElementById("input1").removeAttribute("readonly");
testSelector("#set1 :read-write", ["input1"], "The :read-write pseudo-class must not match input elements after the readonly attribute has been removed");
testSelector("#set1 :read-only", ["input2"], "The :read-only pseudo-class must match input elements after the readonly attribute has been removed");
testSelector("#set2 :read-write", ["textarea1"], "The :read-write pseudo-class must match textarea elements that do not have a readonly attribute, and that are not disabled");
testSelector("#set2 :read-only", ["textarea2"], "The :read-only pseudo-class must match textarea elements that have a readonly attribute, or that are disabled");
document.getElementById("textarea1").setAttribute("readonly", "readonly");
testSelector("#set2 :read-write", [], "The :read-write pseudo-class must match textarea elements after the readonly attribute has been added");
testSelector("#set2 :read-only", ["textarea1", "textarea2"], "The :read-only pseudo-class must match textarea elements after the readonly attribute has been added");
testSelector("#set3 :read-write", ["textarea3"], "The :read-write pseudo-class must not match textarea elements that are disabled");
testSelector("#set3 :read-only", ["textarea4"], "The :read-only pseudo-class must match textarea elements that are disabled");
testSelector("#set4 :read-write", ["p2"], "The :read-write pseudo-class must match elements that are editable");
testSelector("#set4 :read-only", ["p1"], "The :read-only pseudo-class must not match elements that are editable");
document.designMode = "on";
testSelector("#set4 :read-write", ["p1", "p2"], "The :read-write pseudo-class must match elements that are editing hosts");
testSelector("#set4 :read-only", [], "The :read-only pseudo-class must not match elements that are editing hosts");
</script>

View file

@ -0,0 +1,35 @@
<!DOCTYPE html>
<meta charset=utf-8>
<title>Selector: pseudo-classes (:required, :optional)</title>
<link rel="author" title="Denis Ah-Kang" href="mailto:denis@w3.org" id=link1>
<link rel=help href="https://html.spec.whatwg.org/multipage/#pseudo-classes" id=link2>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="utils.js"></script>
<div id="log"></div>
<input type=text id=text1 value="foobar" required>
<input type=text id=text2 required>
<input type=text id=text3>
<select id=select1 required>
<optgroup label="options" id=optgroup1>
<option value="option1" id=option1>option1
</select>
<select id=select2>
<optgroup label="options" id=optgroup2>
<option value="option2" id=option2>option2
</select>
<textarea required id=textarea1>textarea1</textarea>
<textarea id=textarea2>textarea2</textarea>
<script>
testSelector(":required", ["text1", "text2", "select1", "textarea1"], "':required' matches required <input>s, <select>s and <textarea>s");
testSelector(":optional", ["text3", "select2", "textarea2"], "':optional' matches elements <input>s, <select>s and <textarea>s that are not required");
document.getElementById("text1").removeAttribute("required");
testSelector(":required", ["text2", "select1", "textarea1"], "':required' doesn't match elements whose required attribute has been removed");
testSelector(":optional", ["text1", "text3", "select2", "textarea2"], "':optional' matches elements whose required attribute has been removed");
document.getElementById("select2").setAttribute("required", "required");
testSelector(":required", ["text2", "select1", "select2", "textarea1"], "':required' matches elements whose required attribute has been added");
testSelector(":optional", ["text1", "text3", "textarea2"], "':optional' doesn't match elements whose required attribute has been added");
</script>

View file

@ -0,0 +1,14 @@
function getElementsByIds(ids) {
var result = [];
ids.forEach(function(id) {
result.push(document.getElementById(id));
});
return result;
}
function testSelector(selector, expected, testName) {
test(function(){
var elements = document.querySelectorAll(selector);
assert_array_equals(elements, getElementsByIds(expected));
}, testName);
}

View file

@ -0,0 +1,68 @@
<!DOCTYPE html>
<meta charset=utf-8>
<title>Selector: pseudo-classes (:valid, :invalid)</title>
<link rel="author" title="Denis Ah-Kang" href="mailto:denis@w3.org" id=link1>
<link rel=help href="https://html.spec.whatwg.org/multipage/#pseudo-classes" id=link2>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="utils.js"></script>
<div id="log"></div>
<div id='simpleConstraints'>
<input type=text id=text1 value="foobar" required>
<input type=text id=text2 required>
</div>
<div id='FormSelection'>
<form id=form1>
<input type=text id=text3 value="foobar" required>
</form>
<form id=form2>
<input type=text id=text4 required>
</form>
</div>
<div id='FieldSetSelection'>
<fieldset id=fieldset1>
<input type=text id=text5 value="foobar" required>
</fieldset>
<fieldset id=fieldset2>
<input type=text id=text6 required>
</fieldset>
</div>
<div id='patternConstraints'>
<input type=text id=text7 value="AAA" pattern="[0-9][A-Z]{3}">
<input type=text id=text8 value="0AAA" pattern="[0-9][A-Z]{3}">
</div>
<div id='numberConstraints'>
<input type=number id=number1 value=0 min=1>
<input type=number id=number2 value=1 min=1>
</div>
<script>
testSelector("#simpleConstraints :valid", ["text1"], "':valid' matches elements that satisfy their constraints");
testSelector("#FormSelection :valid", ["form1", "text3"], "':valid' matches form elements that are not the form owner of any elements that themselves are candidates for constraint validation but do not satisfy their constraints");
testSelector("#FieldSetSelection :valid", ["fieldset1", "text5"], "':valid' matches fieldset elements that have no descendant elements that themselves are candidates for constraint validation but do not satisfy their constraints");
testSelector("#patternConstraints :valid", [ "text8" ], "':valid' matches elements that satisfy their pattern constraints");
testSelector("#numberConstraints :valid", [ "number2" ], "':valid' matches elements that satisfy their number constraints");
testSelector("#simpleConstraints :invalid", ["text2"], "':invalid' matches elements that do not satisfy their simple text constraints");
testSelector("#FormSelection :invalid", ["form2", "text4"], "':invalid' matches form elements that are the form owner of one or more elements that themselves are candidates for constraint validation but do not satisfy their constraints");
testSelector("#FieldSetSelection :invalid", ["fieldset2", "text6"], "':invalid' matches fieldset elements that have of one or more descendant elements that themselves are candidates for constraint validation but do not satisfy their constraints");
testSelector("#patternConstraints :invalid", ["text7"], "':invalid' matches elements that do not satisfy their pattern constraints");
testSelector("#numberConstraints :invalid", ["number1"], "':invalid' matches elements that do not satisfy their number constraints");
document.getElementById("text7").value="0BBB";
testSelector("#patternConstraints :valid", [ "text7", "text8" ], "':valid' matches new elements that satisfy their constraints");
testSelector("#patternConstraints :invalid", [], "':invalid' doesn't match new elements that satisfy their constraints");
document.getElementById("text8").value="BBB";
testSelector("#patternConstraints :valid", ["text7"], "':valid' doesn't match new elements that do not satisfy their constraints");
testSelector("#patternConstraints :invalid", ["text8"], "':invalid' matches new elements that do not satisfy their constraints");
</script>