Skip to content

Commit d2a2a57

Browse files
7suyash7chromium-wpt-export-bot
authored andcommitted
Convert Image Tests 1-5 to use Actions API.
Bug: 1302171 Change-Id: I8f244da023d23c5f77957e63bd322f1fd8a3aa69 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3858858 Commit-Queue: Suyash Nayan <[email protected]> Reviewed-by: Andrew Williams <[email protected]> Cr-Commit-Position: refs/heads/main@{#1045281}
1 parent 65d9403 commit d2a2a57

File tree

4 files changed

+82
-4
lines changed

4 files changed

+82
-4
lines changed

html/editing/dnd/images/001.html

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
11
<!doctype html>
2+
<script src="/resources/testharness.js"></script>
3+
<script src="/resources/testharnessreport.js"></script>
4+
<script src="/resources/testdriver.js"></script>
5+
<script src="/resources/testdriver-vendor.js"></script>
6+
<script src="/resources/testdriver-actions.js"></script>
7+
<script src="../resources/test-helper.js"></script>
28
<head>
39
<title>Image drag and drop</title>
410
<style type="text/css">
@@ -25,7 +31,21 @@
2531
<div
2632
ondragenter="event.preventDefault()"
2733
ondragover="return false"
28-
ondrop="addImage(event)"
2934
/>
35+
<script>
36+
async function test() {
37+
await new Promise(loaded => window.addEventListener("load", loaded));
38+
const img = document.querySelector('img');
39+
const div = document.querySelector('div');
40+
function onDropCallBack(event) {
41+
addImage(event);
42+
assert_equals(img.src, event.dataTransfer.getData('text/uri-list').replace(/\r\n$/,''));
43+
return true;
44+
}
45+
46+
dragDropTest(img, div, onDropCallBack, 'Dragging the image to the bottom div should copy the image there"');
47+
}
48+
test();
49+
</script>
3050
</body>
3151
</html>

html/editing/dnd/images/002.html

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
11
<!doctype html>
2+
<script src="/resources/testharness.js"></script>
3+
<script src="/resources/testharnessreport.js"></script>
4+
<script src="/resources/testdriver.js"></script>
5+
<script src="/resources/testdriver-vendor.js"></script>
6+
<script src="/resources/testdriver-actions.js"></script>
7+
<script src="../resources/test-helper.js"></script>
28
<head>
39
<title>dataURL image drag and drop</title>
410
<style type="text/css">
@@ -25,7 +31,21 @@
2531
<div
2632
ondragenter="event.preventDefault()"
2733
ondragover="return false"
28-
ondrop="addImage(event)"
2934
/>
35+
<script>
36+
async function test(){
37+
await new Promise(loaded => window.addEventListener("load", loaded));
38+
const img = document.querySelector('img');
39+
const div = document.querySelector('div');
40+
function onDropCallBack(event) {
41+
addImage(event);
42+
assert_equals(img.src, event.dataTransfer.getData('text/uri-list').replace(/\r\n$/,''));
43+
return true;
44+
}
45+
46+
dragDropTest(img, div, onDropCallBack, 'Dragging the dataURL PNG image to the bottom div should copy the image there');
47+
}
48+
test();
49+
</script>
3050
</body>
3151
</html>

html/editing/dnd/images/004.html

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
11
<!doctype html>
2+
<script src="/resources/testharness.js"></script>
3+
<script src="/resources/testharnessreport.js"></script>
4+
<script src="/resources/testdriver.js"></script>
5+
<script src="/resources/testdriver-vendor.js"></script>
6+
<script src="/resources/testdriver-actions.js"></script>
7+
<script src="../resources/test-helper.js"></script>
28
<head>
39
<title>Object with image drag and drop</title>
410
<style type="text/css">
@@ -28,7 +34,20 @@
2834
<div
2935
ondragenter="event.preventDefault()"
3036
ondragover="return false"
31-
ondrop="addImage(event)"
3237
/>
3338
</body>
39+
<script>
40+
async function test() {
41+
const object = document.querySelector('object');
42+
const div = document.querySelector('div');
43+
function onDropCallBack(event) {
44+
addImage(event);
45+
assert_equals(object.getAttribute('data'), event.dataTransfer.getData('text/uri-list').replace(/\r\n$/,''));
46+
return true;
47+
}
48+
49+
dragDropTest(object, div, onDropCallBack, 'Dragging the object to the bottom div should copy the image there');
50+
}
51+
test();
52+
</script>
3453
</html>

html/editing/dnd/images/005.html

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
11
<!doctype html>
2+
<script src="/resources/testharness.js"></script>
3+
<script src="/resources/testharnessreport.js"></script>
4+
<script src="/resources/testdriver.js"></script>
5+
<script src="/resources/testdriver-vendor.js"></script>
6+
<script src="/resources/testdriver-actions.js"></script>
7+
<script src="../resources/test-helper.js"></script>
28
<head>
39
<title>JPG image drag and drop</title>
410
<style type="text/css">
@@ -25,7 +31,20 @@
2531
<div
2632
ondragenter="event.preventDefault()"
2733
ondragover="return false"
28-
ondrop="addImage(event)"
2934
/>
3035
</body>
36+
<script>
37+
async function test() {
38+
const img = document.querySelector('img');
39+
const div = document.querySelector('div');
40+
function onDropCallBack(event) {
41+
addImage(event);
42+
assert_equals(img.src, event.dataTransfer.getData('text/uri-list').replace(/\r\n$/,''));
43+
return true;
44+
}
45+
46+
dragDropTest(img, div, onDropCallBack, 'Dragging the dataURL JPG image to the bottom div should copy the image there');
47+
}
48+
test();
49+
</script>
3150
</html>

0 commit comments

Comments
 (0)