blob: 87fdb1e57c3f4084665a61422eb812396c16c427 [file] [log] [blame]
<html>
<head>
<script>
function test() {
var sl = document.getElementById('sl');
sl.focus();
document.execCommand("SelectAll");
if (!document.getElementById('o1').selected && !document.getElementById('o2').selected && !document.getElementById('o3').selected)
log("Test 1 Passed");
else
log("Test 1 Failed. SelectAll should not change a single-select list box.");
sl.multiple = true;
document.execCommand("SelectAll");
if (document.getElementById('o1').selected && document.getElementById('o2').selected && document.getElementById('o3').selected)
log("Test 2 Passed");
else
log("Test 2 Failed. SelectAll should select all items in a multi-select list box.");
sl.multiple = false;
if (window.testRunner)
testRunner.dumpAsText();
}
function log(msg) {
var res = document.getElementById('res');
res.innerHTML = res.innerHTML + msg + "<br>";
}
</script>
</head>
<body onload="test()">
This tests that select all works on options in a list box.<br>
<select id="sl" size=5>
<option id="o1">1
<option id="o2">2
<option id="o3">3
</select>
<div id="res"></div>
</body>
</html>