Upstream version 7.36.149.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / LayoutTests / editing / pasteboard / onpaste-text-html.html
1 <div id="test">This test verifies that we can get text/html from the clipboard
2 during an onpaste event.  This test requires DRT.</div>
3
4 <div id="target" contenteditable onpaste="paste(event)">
5 Paste content in this div.
6 </div>
7 <div id="results">FAIL</div>
8
9 <script src="../editing.js"></script>
10 <script>
11 var undefined;
12 function removeFontName(text)
13 {
14     if (!text)
15         return text;
16     return text.replace(/font-family: [^;]+;\s*/g, "");
17 }
18
19 function paste(ev)
20 {
21     console.log("text/plain: " + ev.clipboardData.getData("text/plain"));
22     // Remove the font name because it varies depending on the platform.
23     console.log("text/html: " + removeFontName(ev.clipboardData.getData("text/html")));
24     if (ev.clipboardData.getData("text/html") != undefined)
25         document.getElementById("results").innerHTML = "PASS";
26 }
27
28 function editingTest()
29 {
30     var selection = window.getSelection();
31     selection.modify("extend", "forward", "sentence");
32     copyCommand();
33
34     var elem = document.getElementById("target");
35     selection.collapse(elem, 0);
36     selection.modify("move", "forward", "sentence");
37     pasteCommand();
38 }
39
40 runDumpAsTextEditingTest(false);
41 </script>