Bug 1517394 [wpt PR 8693] - Add DataTransferItem getAsString test, a=testonly
authorkaixinjxq <xiuqix.jiang@intel.com>
Thu, 31 Jan 2019 15:43:03 +0000
changeset 457842 7d41cf15351f82e46d51367a7a73d31e816f6673
parent 457841 8b41d4f59a4184d129082af76c221ca5db1164c6
child 457843 6fb77b4ebf6d29588b011f10400491a519977570
push id35518
push useropoprus@mozilla.com
push dateFri, 08 Feb 2019 09:55:14 +0000
treeherdermozilla-central@3a3e393396f4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstestonly
bugs1517394
milestone67.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1517394 [wpt PR 8693] - Add DataTransferItem getAsString test, a=testonly Automatic update from web-platform-tests HTML: DataTransferItem getAsString -- wpt-commits: 578d93d111e32702df96bd2d35849d887d126ccd wpt-pr: 8693
testing/web-platform/tests/html/editing/dnd/the-datatransferitem-interface/getAsString-manual.html
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/tests/html/editing/dnd/the-datatransferitem-interface/getAsString-manual.html
@@ -0,0 +1,39 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>DataTransferItem Test: getAsString()</title>
+<link rel="author" title="Intel" href="http://www.intel.com">
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+
+<p><input type="text" value="dragcharacters" style="border:2px blue solid; width:200px; height: 100px;"/></p>
+<p><input id="container" type="text" style="border:2px green solid; width:200px; height: 100px;"/></p>
+
+<p>Select all characters in blue box and drag to green box then drop on the green box</p>
+
+<script>
+
+setup({explicit_done : true, explicit_timeout : true});
+
+let container = document.getElementById("container");
+
+on_event(container, "drop", evt => {
+  let item = evt.dataTransfer.items[0];
+
+  test(() => {
+    let file1 = item.getAsFile();
+    assert_equals(file1, null);
+  }, "Check if DataTransferItem.getAsFile return null if drag data item kind is not File");
+
+  let data;
+  item.getAsString(str => {
+    data = str;
+  });
+  setTimeout(() => {
+    test(() => {
+      assert_equals(data, "dragcharacters");
+    }, "Check if DataTransferItem.getAsString return the dragged string");
+    done();
+  }, 0);
+});
+
+</script>