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

Unified Diff: third_party/WebKit/LayoutTests/fast/forms/checkValidity.html

Issue 2210743002: Merge layout tests checkValidity-00n.html into one. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Build HTML tree in each of tests Created 4 years, 4 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
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/fast/forms/checkValidity-001.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/LayoutTests/fast/forms/checkValidity.html
diff --git a/third_party/WebKit/LayoutTests/fast/forms/checkValidity.html b/third_party/WebKit/LayoutTests/fast/forms/checkValidity.html
new file mode 100644
index 0000000000000000000000000000000000000000..2e9e89ee3ee8e2135c52c5afda63bfa8d4a4f11e
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/fast/forms/checkValidity.html
@@ -0,0 +1,80 @@
+<!DOCTYPE html>
+<body>
+<script src="../../resources/testharness.js"></script>
+<script src="../../resources/testharnessreport.js"></script>
+<div id="sample"></div>
+<script>
+// See also imported/wpt/html/semantics/forms/constraints/form-validation-checkValidity.html.
+
+function checkValidityFor(html) {
+ var sample = document.getElementById('sample');
+ sample.innerHTML = html;
+ return sample.firstChild.checkValidity();
+}
+
+test(() => {
+ assert_true(checkValidityFor('<fieldset></fieldset>'));
+}, 'checkValidity() for FIELDSET should return true.');
+
+test(() => {
+ assert_true(checkValidityFor('<fieldset><input required></fieldset>'));
+}, 'checkValidity() for FIELDSET with an invalid INPUT should return true.');
+
+test(() => {
+ assert_true(checkValidityFor('<button>lorem ipsum</button>'));
+}, 'checkValidity() for BUTTON should return true.');
+
+test(() => {
+ assert_true(checkValidityFor('<output></output>'));
+}, 'checkValidity() for OUTPUT should return true.');
+
+test(() => {
+ assert_true(checkValidityFor('<object></object>'));
+}, 'checkValidity() for OBJECT should return true.');
+
+test(() => {
+ assert_true(checkValidityFor('<keygen></keygen>'));
+}, 'checkValidity() for KEYGEN should return true.');
+
+test(() => {
+ assert_true(checkValidityFor('<select required>' +
+ ' <option>empty</option>' +
+ ' <option>another</option>' +
+ '</select>'));
+}, 'checkValidity() for SELECT without a placeholder OPTION should return true.');
+
+test(() => {
+ assert_false(checkValidityFor('<select required>' +
+ ' <option value="" selected />' +
+ ' <option value="X">X</option>' +
+ '</select>'));
+}, 'checkValidity() for SELECT with a placeholder OPTION should return false.');
+
+test(() => {
+ assert_true(checkValidityFor('<select required>' +
+ ' <option value="X">X</option>' +
+ ' <option value="" selected />' +
+ '</select>'));
+}, 'checkValidity() for SELECT with a selected empty second OPTION should return true.');
+
+test(() => {
+ assert_true(checkValidityFor('<form method="get">' +
+ '<fieldset name="victim"></fieldset>' +
+ '<input name="victim" type="text" value="lorem ipsum"/>' +
+ '<button name="victim">lorem ipsum</button>' +
+ '<select name="victim"></select>' +
+ '<textarea name="victim"></textarea>' +
+ '</form>'));
+}, 'checkValidity() for FORM with valid controls should return true.');
+
+test(() => {
+ assert_false(checkValidityFor('<form method="get">' +
+ '<fieldset name="victim"></fieldset>' +
+ '<input name="victim" type="text" value="invalid" pattern="something"/>' +
+ '<button name="victim">lorem ipsum</button>' +
+ '<select name="victim"></select>' +
+ '<textarea name="victim"></textarea>' +
+ '</form>'));
+}, 'checkValidity() for FORM with an invalid control should return false.');
+</script>
+</body>
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/fast/forms/checkValidity-001.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698