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

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

Issue 660783002: Implement reportValidity() (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: 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-004.html
diff --git a/LayoutTests/fast/forms/reportValidity-004.html b/LayoutTests/fast/forms/reportValidity-004.html
new file mode 100644
index 0000000000000000000000000000000000000000..54918b7386804b9625e1bdf6122587db37616618
--- /dev/null
+++ b/LayoutTests/fast/forms/reportValidity-004.html
@@ -0,0 +1,47 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<script src="../../resources/js-test.js"></script>
+<style>
+:focus { background: rgb(0, 255, 0); }
+:not(:focus) { background: rgb(255, 0, 0); }
+</style>
+</head>
+<body>
+<p id="description"></p>
+<form method="get" id="sad_form">
+<fieldset name="victim">
+<input id="input-unset" name="victim" type="text" required/>
+</fieldset>
+<input name="victim" type="text" value="invalid" pattern="something"/>
+<button name="victim">lorem ipsum</button>
+<textarea name="victim" required></textarea>
+<select required>
+ <option>empty</option>
+ <option>another</option>
+</select>
+<select name="victim" required>
+ <option value="" selected />
+ <option value="X">X</option>
+</select>
+<select name="victim" required>
+ <option value="X">X</option>
+ <option value="" selected />
+</select>
+</form>
+<div id="console"></div>
+<script>
+function backgroundOf(id) {
+ return document.defaultView.getComputedStyle(document.getElementById(id), null).getPropertyValue('background-color');
+}
+var unfocusedColor = 'rgb(255, 0, 0)';
+var focusedColor = 'rgb(0, 255, 0)';
+
+description("This test checks if reportValidity() returns correctly a false (meaning there's an invalid element) result on form element.");
+
+f = document.getElementById("sad_form");
+shouldBe("f.reportValidity()", "false");
+shouldBe("backgroundOf('input-unset')", "focusedColor");
keishi 2014/10/21 08:20:14 We can use document.activeElement to check if the
Bartek Nowierski 2014/10/21 11:03:52 Done.
+</script>
+</body>
+</html>

Powered by Google App Engine
This is Rietveld 408576698