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

Unified Diff: LayoutTests/editing/deleting/merge-paragraph-with-first-letter.html

Issue 20681004: Make first-letter style to work with editing Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: 2013-09-20T18:27:32 Created 7 years, 3 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
Index: LayoutTests/editing/deleting/merge-paragraph-with-first-letter.html
diff --git a/LayoutTests/editing/deleting/merge-paragraph-with-first-letter.html b/LayoutTests/editing/deleting/merge-paragraph-with-first-letter.html
new file mode 100644
index 0000000000000000000000000000000000000000..8c5e35883c8a10871d2675e7492492e4fa836bed
--- /dev/null
+++ b/LayoutTests/editing/deleting/merge-paragraph-with-first-letter.html
@@ -0,0 +1,43 @@
+<head>
+<style>
+.test:first-letter {
+ color: red;
+}
+</style>
+</head>
+<body>
+<div id="container">
+<div id="sample" contenteditable="true">
+<p class="test">abcdefgh</p>
+</div>
+</div>
+<script src="../../fast/js/resources/js-test-pre.js"></script>
+<script>
+function $(id) { return document.getElementById(id); }
+$('sample').focus();
+
+var range = document.createRange();
+range.setStart($('sample').querySelector('p.test').firstChild, 4);
+var selection = window.getSelection();
+selection.removeAllRanges();
+selection.addRange(range);
+
+debug('Insert newline');
+document.execCommand('InsertText', false, '\n');
+shouldBeEqualToString('selection.type', 'Caret');
+shouldBe('selection.anchorNode', 'document.querySelectorAll("p.test")[1].firstChild');
+shouldBe('selection.anchorOffset', '0');
+shouldBeEqualToString('selection.anchorNode.textContent', 'efgh');
+
+debug('Delete newline');
+document.execCommand('Delete');
+shouldBeEqualToString('selection.type', 'Caret');
+shouldBe('selection.anchorNode', 'document.querySelectorAll("p.test")[0].firstChild');
+shouldBe('selection.anchorOffset', '4');
+shouldBeEqualToString('selection.anchorNode.textContent', 'abcdefgh');
+
+if (window.testRunner)
+ $('container').outerHTML = '';
+</script>
+<script src="../../fast/js/resources/js-test-post.js"></script>
+</body>

Powered by Google App Engine
This is Rietveld 408576698