Source code

Revision control

Copy as Markdown

Other Tools

Test Info: Warnings

<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Reload during text input selection drag and drop roundtrip</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/resources/testdriver.js"></script>
<script src="/resources/testdriver-vendor.js"></script>
<script src="/resources/testdriver-actions.js"></script>
<script src="support/drag-reload-test.js"></script>
<style>
body { margin: 20px; }
input { width: 8ch; }
</style>
<script>
function sourceDragStart(event) {
location.reload();
}
function targetDrop(event) {
event.preventDefault();
const data = event.dataTransfer.getData('text/plain');
event.currentTarget.value = data === 'Drag me' ? 'PASS' : 'FAIL';
}
</script>
</head>
<body>
<input id="source" value="Drag me"
ondragstart="sourceDragStart(event)" ondragenter="event.preventDefault()"
ondragover="event.preventDefault()" ondrop="targetDrop(event)">
<script>
window.addEventListener('load', () => {
const source = document.getElementById('source');
source.focus();
source.select();
});
testDragAcrossReload({
dataType: 'text/plain',
getExpectedData: source => source.value,
verifyDrop: target => {
assert_equals(target.value, 'PASS', 'The input receives the selection');
},
});
</script>
</body>
</html>