Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / editing / pasteboard / onpaste-text-html.html
blobb9dc9d37384ef01bde2175499830a019337b364b
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>
4 <div id="target" contenteditable onpaste="paste(event)">
5 Paste content in this div.
6 </div>
7 <div id="results">FAIL</div>
9 <script src="../editing.js"></script>
10 <script>
11 var undefined;
12 function removeFontName(text)
14 if (!text)
15 return text;
16 return text.replace(/font-family: [^;]+;\s*/g, "");
19 function paste(ev)
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";
28 function editingTest()
30 var selection = window.getSelection();
31 selection.modify("extend", "forward", "sentence");
32 copyCommand();
34 var elem = document.getElementById("target");
35 selection.collapse(elem, 0);
36 selection.modify("move", "forward", "sentence");
37 pasteCommand();
40 runDumpAsTextEditingTest(false);
41 </script>