Chromium Code Reviews| 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> |