Source code

Revision control

Copy as Markdown

Other Tools

Test Info: Warnings

<!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 between iframes: dropping block element onto canvas</title>
<style type="text/css">
iframe {
width: 300px;
height: 200px;
border-style: none;
}
</style>
</head>
<body>
<p><iframe src="helper-drag-me-green-box.xhtml" id="drag-iframe">Green box</iframe></p>
<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" id="drop-iframe">Canvas</iframe></p>
<script>
async function test() {
await new Promise(loaded => window.addEventListener("load", loaded));
const div = frames[0].document.querySelector('div');
const canvas = frames[1].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 dragIframe = document.getElementById('drag-iframe');
const dropIframe = document.getElementById('drop-iframe');
dragDropTest(div, canvas, onDropCallBack, 'Dragging the iframe to the bottom iframe should turn it green',
dragIframe, dropIframe);
}
test();
</script>
</body>
</html>