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

Unified Diff: LayoutTests/editing/selection/click-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/selection/click-first-letter.html
diff --git a/LayoutTests/editing/selection/click-first-letter.html b/LayoutTests/editing/selection/click-first-letter.html
new file mode 100644
index 0000000000000000000000000000000000000000..d2c08507fb664063f7d59c52eab413f67baf0216
--- /dev/null
+++ b/LayoutTests/editing/selection/click-first-letter.html
@@ -0,0 +1,60 @@
+<!DOCTYPE html>
+<html>
+<head>
+<style>
+.test {
+ font-family: monospace;
+}
+.test:first-letter {
+ color: red;
+}
+</style>
+</head>
+<body>
+<div id="container">
+<p id="description"></p>
+<ol>
+<li>Click at "a" to see caret is before "a".</li>
+<li>Click between "d" and "e" to see caret is between "d" and "e"</li>
+<li>Hit enter to see next line is "efgh".
+</ol>
+<div id="sample" contenteditable="true">
+<p class="test"><span id="test">abcdefgh</span></p>
+</div>
+</div>
+<div id="console"></div>
+<script src="../../fast/js/resources/js-test-pre.js"></script>
+<script>
+description('Check click to set caret position with first-letter style. http://crbug.com/266334');
+function $(id) { return document.getElementById(id); }
+
+var selection = window.getSelection();
+
+if (window.eventSender) {
+ var test = $('test');
+
+ debug('Click at first letter');
+ eventSender.mouseMoveTo(test.offsetLeft + 1, test.offsetTop);
+ eventSender.mouseDown();
+ eventSender.mouseUp();
+
+ shouldBeEqualToString('selection.type', 'Caret');
+ shouldBe('selection.anchorNode', 'test.firstChild');
+ shouldBe('selection.anchorOffset', '0');
+
+ debug('Click at middle');
+ eventSender.mouseMoveTo(test.offsetLeft + test.offsetWidth / 2, test.offsetTop);
+ eventSender.mouseDown();
+ eventSender.mouseUp();
+
+ shouldBeEqualToString('selection.type', 'Caret');
+ shouldBe('selection.anchorNode', 'test.firstChild');
+ shouldBe('selection.anchorOffset', '4');
+}
+
+if (window.testRunner)
+ $('container').outerHTML = '';
+</script>
+<script src="../../fast/js/resources/js-test-post.js"></script>
+</body>
+</html>

Powered by Google App Engine
This is Rietveld 408576698