blob: 869483249035594a009110895e4fc408ae1efa8e [file] [log] [blame]
<!DOCTYPE html>
<html>
<head>
<script>
function log(text) {
var log = document.getElementById('log');
log.appendChild(document.createTextNode(text));
log.appendChild(document.createElement('br'));
}
function copyTest(e) {
e.clipboardData.setData('text/plain', 'copy test');
if (event.clipboardData.types.indexOf('text/plain') < 0 ||
event.clipboardData.getData('text/plain') != 'copy test')
log('copy: FAILED');
else
log('copy: SUCCESS');
}
function cutTest(e) {
e.clipboardData.setData('text/plain', 'cut test');
if (event.clipboardData.types.indexOf('text/plain') < 0 ||
event.clipboardData.getData('text/plain') != 'cut test')
log('cut: FAILED');
else
log('cut: SUCCESS');
}
function runTest() {
if (!window.testRunner)
return;
testRunner.dumpAsText();
document.execCommand('copy');
document.execCommand('cut');
}
</script>
</head>
<body onload="runTest()" oncopy="copyTest(event)" oncut="cutTest(event)">
<p>Simple test that data set during a copy/cut event can be read back. To run
the test manually, simply select any text and initiate a copy/cut operation.
<div id="log"></div>
</html>