blob: de55fb1b8d934220b64db397a20076e3925dd0f0 [file] [log] [blame]
<!DOCTYPE html>
<html>
<head>
<script src="../../../resources/js-test.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>
</body>
</html>