Automatic update from web-platform-tests [2/4] Improve WPT Drag and Drop images/ tests This CL automates the drag and drop tests that start a drag in an iframe (from 011 to 014). These tests are now using the test actions API and testharness to verify that these scenarios work properly. Several other tests had to be touched up to account for the new variable in dragDropTest. Bug: 40216874 Change-Id: Id4d45bbdf07b1e8e8cf9294c5986b5f851f4c520 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6664880 Reviewed-by: Mustaq Ahmed <mustaq@chromium.org> Commit-Queue: Gaston Rodriguez <gastonr@microsoft.com> Reviewed-by: Rahul Arakeri <arakeri@microsoft.com> Cr-Commit-Position: refs/heads/main@{#1481888} -- wpt-commits: 97516874db2186c55e3709bc099ca5d513682d40 wpt-pr: 53548
55 lines
1.8 KiB
HTML
55 lines
1.8 KiB
HTML
<!doctype html>
|
|
<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="../resources/test-helper.js"></script>
|
|
<head>
|
|
<title>Drag and drop to iframe: dropping block element onto canvas</title>
|
|
<style type="text/css">
|
|
div {
|
|
width: 20px;
|
|
height: 20px;
|
|
background-color: green;
|
|
}
|
|
|
|
iframe {
|
|
width: 200px;
|
|
height: 200px;
|
|
border-style: none;
|
|
}
|
|
</style>
|
|
<script type="application/ecmascript">
|
|
function start(event) {
|
|
event.dataTransfer.effectAllowed = 'copy';
|
|
event.dataTransfer.setData('text/plain', 'green');
|
|
}
|
|
</script>
|
|
</head>
|
|
<body>
|
|
<div draggable="true" ondragstart="start(event)"></div>
|
|
<p>Drag green box above to the gray canvas below. Canvas should turn green when you drop green box on it.</p>
|
|
<p><iframe src="helper-drop-here-canvas.xhtml">Canvas</iframe></p>
|
|
<script>
|
|
async function test() {
|
|
await new Promise(loaded => window.addEventListener("load", loaded));
|
|
const canvas = frames[0].document.querySelector('canvas');
|
|
|
|
function onDropCallBack(event) {
|
|
let style = window.getComputedStyle(canvas);
|
|
let currentColor = "rgba(0, 0, 0, 0)";
|
|
assert_equals(style.getPropertyValue("background-color"), currentColor);
|
|
return true;
|
|
}
|
|
|
|
const div = document.querySelector('div');
|
|
const iframe = document.querySelector('iframe');
|
|
dragDropTest(div, canvas, onDropCallBack,
|
|
'Dragging the div to the bottom iframe should turn it green', /*dragIframe=*/ null, iframe);
|
|
}
|
|
test();
|
|
</script>
|
|
</body>
|
|
</html>
|