blob: 5603a6d967a9eb9ba8c1f8086b13dc5a08d81b86 [file] [log] [blame]
<!DOCTYPE html>
<html>
<body>
<script src="../../resources/js-test-pre.js"></script>
<script>
description("Tests that DataTransfer's types contains text/plain but not no image types when pasting a plain text. To manually test, click on the button below then trigger paste (Command+V or Control+V).");
jsTestIsAsync = true;
function check(event) {
types = event.clipboardData.types;
shouldBeTrue('types.includes("text/plain")');
shouldBeUndefined('types.find((type) => type.includes("png"))');
shouldBeUndefined('types.find((type) => type.includes("jpeg"))');
shouldBeUndefined('types.find((type) => type.includes("tiff"))');
document.getElementById('container').style.display = 'none';
finishJSTest();
}
function runTest()
{
const source = document.getElementById('source');
source.focus();
source.contentDocument.execCommand('selectAll', false, null);
source.contentDocument.execCommand('copy', false, null);
document.getElementById('destination').focus();
document.getElementById('destination').textContent = 'Now, paste here';
document.execCommand('selectAll', false, null);
document.querySelector('button').style.display = 'none';
source.style.display = 'none';
document.execCommand('paste', false, null);
}
successfullyParsed = true;
</script>
<div id="container">
<button onclick="runTest()">Copy</button><br>
<iframe id="source" onload="window.testRunner && runTest()" src="../resources/text-pasteboard-data.txt"></iframe>
<div id="destination" contenteditable="true" onpaste="check(event)"></div>
</div>
<script src="../../resources/js-test-post.js"></script>
</body>
</html>