Move parseFontFaceDescriptor to CSSPropertyParser.cpp
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / editing / pasteboard / copy-null-characters.html
blob189c8c95c3d0ce856279106b188241425408a931
1 <head>
2 <script src="../../resources/dump-as-markup.js"></script>
3 <script>
4 Markup.description('If there are NULL characters in text nodes, they should not be copied to the clipboard. This test requires DumpRenderTree.');
5 Markup.noAutoDump();
7 function runTest()
9 var sel = window.getSelection();
11 var source = document.getElementById("source");
12 var textWithNull = "Copy\0 paste me";
13 source.textContent = textWithNull;
15 var results = document.getElementById("results");
16 // Make sure innerHTML still has the NULL.
17 if (source.innerHTML != textWithNull) {
18 results.innerText = "source.innerHTML has the wrong value (expected " +
19 JSON.stringify(textWithNull) + " but found " +
20 JSON.stringify(source.innerHTML) + ").";
21 Markup.dump(document.body);
22 Markup.notifyDone();
23 return;
26 sel.collapse(source, 0);
27 document.execCommand("SelectAll");
28 document.execCommand("Copy");
30 var destinationRichText = document.getElementById("destination-rich-text");
31 sel.collapse(destinationRichText, 0);
32 document.execCommand("Paste");
34 var destinationPlainText = document.getElementById("destination-plain-text");
35 destinationPlainText.focus();
36 document.execCommand("Paste");
38 var expectedPlainTextValue = "Copy paste me";
39 if (expectedPlainTextValue != destinationPlainText.value) {
40 results.innerText = "Plain text field has the wrong value (expected " +
41 JSON.stringify(expectedPlainTextValue) + " but found " +
42 JSON.stringify(destinationPlainText.value) + ").";
43 Markup.dump(document.body);
44 Markup.notifyDone();
45 return;
48 // Run the same test but include some richly formatted text.
49 var outerSource = document.getElementById("outerSource");
50 sel.setBaseAndExtent(outerSource, 0, destinationRichText, 0);
51 document.execCommand("Copy");
53 // Remove the source text so we don't end up with a null character in the
54 // expected output file.
55 source.parentNode.removeChild(source);
57 sel.collapse(destinationRichText, 0);
58 document.execCommand("Paste");
60 destinationPlainText.focus();
61 document.execCommand("Paste");
63 var expectedPlainTextValue2 = "Copy paste mebold\n\nCopy paste me\ngreen";
64 if (expectedPlainTextValue2 != destinationPlainText.value) {
65 results.innerText = "Plain text field has the wrong value (expected " +
66 JSON.stringify(expectedPlainTextValue2) + " but found " +
67 JSON.stringify(destinationPlainText.value) + ").";
68 Markup.dump(document.body);
69 Markup.notifyDone();
70 return;
73 results.innerText = "PASSED";
75 Markup.dump(document.body);
76 Markup.notifyDone();
78 </script>
79 </head>
81 <body onload="runTest()">
82 <div id="outerSource"><p><b>bold</b></p>
83 <div id="source" contentEditable="true"></div>
84 <p style="color: green">green</p>
85 </div>
86 <div id="destination-rich-text" contentEditable="true"></div>
87 <textarea id="destination-plain-text"></textarea>
88 <div id="results">FAILED</div>
89 </body>