blob: a6692ebfbafc322639626bf2d453eea6f1132282 [file] [log] [blame]
<!DOCTYPE html>
<html>
<head>
<script src="../../../resources/js-test-pre.js"></script>
</head>
<body>
<script>
description('Test for validationMessage IDL attribute for &lt;input type=range>');
var parent = document.createElement('div');
document.body.appendChild(parent);
parent.innerHTML = '<input type=range id=range maxlength=1 pattern=x>';
var input = document.getElementById('range');
function testIt(value, min, max, step)
{
input.setAttribute("max", max);
input.setAttribute("min", min);
input.setAttribute("step", step);
input.setAttribute("value", value);
return input.validationMessage;
}
debug('No message')
shouldBeEqualToString('testIt("", "", "")', '');
debug('Value missing')
input.setAttribute("required", "");
shouldBeEqualToString('testIt("", "", "")', '');
input.removeAttribute("required");
debug('Type mismatch');
shouldBeEqualToString('testIt("foo", "", "")', '');
debug('Range overflow')
shouldBeEqualToString('testIt("200", "", "100")', '');
debug('Range underflow')
shouldBeEqualToString('testIt("10", "50", "100")', '');
debug('Step mismatch')
shouldBeEqualToString('testIt("55", "0", "100", "10")', '');
</script>
<script src="../../../resources/js-test-post.js"></script>
</body>
</html>