Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5)

Unified Diff: third_party/WebKit/LayoutTests/editing/pasteboard/paste-head-contents.html

Issue 2121613003: Include style tags when pasting HTML content. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: EditorTestBase. Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/editing/pasteboard/paste-head-contents-expected.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/LayoutTests/editing/pasteboard/paste-head-contents.html
diff --git a/third_party/WebKit/LayoutTests/editing/pasteboard/paste-head-contents.html b/third_party/WebKit/LayoutTests/editing/pasteboard/paste-head-contents.html
index 952950877776160c51ce6f3e935e2046ed874d19..52da906d7f59af7a5c3fac21e6f078e4d497c56b 100644
--- a/third_party/WebKit/LayoutTests/editing/pasteboard/paste-head-contents.html
+++ b/third_party/WebKit/LayoutTests/editing/pasteboard/paste-head-contents.html
@@ -64,7 +64,7 @@ td
</body>
</html>
</script>
-<p>This test ensures WebKit strips away base, link, meta, style, and title elements before inserting HTML.</p>
+<p>This test ensures WebKit strips away base, link, meta and title elements before inserting HTML.</p>
<div id="test" contenteditable></div>
<pre><script type="text/javascript">
@@ -73,17 +73,26 @@ document.getElementById('test').focus();
document.execCommand('InsertHTML', false, htmlInPasteboard);
var passed = true;
-function expectNoInstanceOf(elementName) {
- var elements = document.body.getElementsByTagName(elementName);
- if (elements.length <= 0)
+
+function expectElementCount(test, selector) {
+ let actual = document.body.querySelectorAll(selector).length;
+ if (test(actual))
return;
- document.write('FAIL - found ' + elements.length + ' ');
- document.write(elements.length == 1 ? 'instance' : 'instances');
- document.writeln(' of ' + elementName + ' element');
+ document.write('FAIL - found ' + actual + ' ');
+ document.write(actual == 1 ? 'instance' : 'instances');
+ document.writeln(' of ' + selector);
passed = false;
}
+function expectNoInstanceOf(elementName) {
+ expectElementCount((x) => x == 0, elementName);
+}
+
+function expectInstancesOf(elementName) {
+ expectElementCount((x) => x > 0, elementName);
+}
+
if (window.testRunner)
testRunner.dumpAsText();
@@ -91,7 +100,9 @@ expectNoInstanceOf('base');
expectNoInstanceOf('meta');
expectNoInstanceOf('link');
expectNoInstanceOf('title');
-expectNoInstanceOf('style');
+
+expectInstancesOf('style');
+
if (passed)
document.writeln('PASS');
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/editing/pasteboard/paste-head-contents-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698