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

Unified Diff: LayoutTests/fast/forms/reportValidity-valid.html

Issue 660783002: Implement reportValidity() (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Apply couple more tkent's comments + pull Created 6 years, 2 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: LayoutTests/fast/forms/reportValidity-valid.html
diff --git a/LayoutTests/fast/forms/reportValidity-valid.html b/LayoutTests/fast/forms/reportValidity-valid.html
new file mode 100644
index 0000000000000000000000000000000000000000..98a9525f3f770829a948f2e940cd8e38c39c4482
--- /dev/null
+++ b/LayoutTests/fast/forms/reportValidity-valid.html
@@ -0,0 +1,57 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<script src="../../resources/js-test.js"></script>
+</head>
+<body>
+<p id="description"></p>
+<form method="get" id="happy_form">
+<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>
+<output name="victim"></output>
+<object name="victim"></object>
+<keygen name="victim"></keygen>
+</form>
+<form action="" id="soon_to_be_happy_form">
+<select required="" id="soon_to_be_happy_select">
+<option>abc</option>
+</select>
+</form>
+<div id="console"></div>
+<script>
+description("This test checks if reportValidity() returns correctly a true (meaning no error) result.");
+
+debug('Elements valid from the begining');
+shouldBe('document.getElementsByTagName("fieldset")[0].reportValidity()', 'true');
+shouldBe('document.getElementsByTagName("input")[0].reportValidity()', 'true');
+shouldBe('document.getElementsByTagName("button")[0].reportValidity()', 'true');
+shouldBe('document.getElementsByTagName("select")[0].reportValidity()', 'true');
+shouldBe('document.getElementsByTagName("textarea")[0].reportValidity()', 'true');
+shouldBe('document.getElementsByTagName("output")[0].reportValidity()', 'true');
+shouldBe('document.getElementsByTagName("object")[0].reportValidity()', 'true');
+shouldBe('document.getElementsByTagName("keygen")[0].reportValidity()', 'true');
+shouldBe('document.getElementById("happy_form")[0].reportValidity()', 'true');
+debug('');
+
+debug('Element valid when changed');
+jsTestIsAsync = true;
+var form = document.getElementById('soon_to_be_happy_form');
+var select = document.getElementById('soon_to_be_happy_select');
+form.onchange = function() {
+ shouldBeTrue('form.reportValidity()');
+ debug('');
+ finishJSTest();
+};
+window.onload = function() {
+ select.value = null;
+ select.focus();
+ if (window.eventSender)
+ eventSender.keyDown('a');
+};
+
+</script>
+</body>
+</html>
« no previous file with comments | « LayoutTests/fast/forms/reportValidity-invalid-expected.txt ('k') | LayoutTests/fast/forms/reportValidity-valid-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698