43 lines
1.2 KiB
HTML
43 lines
1.2 KiB
HTML
<!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();
|
|
testRunner.execCommand('copy');
|
|
testRunner.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>
|