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

Unified Diff: LayoutTests/editing/selection/skip-over-contenteditable.html

Issue 20572005: Allow selection to skip over contenteditable (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase Created 7 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
Index: LayoutTests/editing/selection/skip-over-contenteditable.html
diff --git a/LayoutTests/editing/selection/skip-over-contenteditable.html b/LayoutTests/editing/selection/skip-over-contenteditable.html
new file mode 100644
index 0000000000000000000000000000000000000000..59dac5a5a46b8424ea7f54354e0a39beaeb4d877
--- /dev/null
+++ b/LayoutTests/editing/selection/skip-over-contenteditable.html
@@ -0,0 +1,29 @@
+<!DOCTYPE HTML>
+<html>
+<body>
+<script src="../../fast/js/resources/js-test-pre.js"></script>
+
+<p id="before">Before</p>
+<div contentEditable></div>
+<p id="after">After</p>
+
+<div id="console"></div>
+<script>
+description("Ensure that extending a selection skips past a contentEditable.");
+
+window.before = document.getElementById("before");
yosin_UTC9 2013/08/31 01:00:47 nit: var before = ...
yosin_UTC9 2013/08/31 01:00:47 nit: var before = ...
dmazzoni 2013/09/05 07:57:29 Then I can't reference it in shouldBe, unless I'm
yosin_UTC9 2013/09/05 08:42:48 <div id="foo">x</div> <script> var foo = document.
dmazzoni 2013/09/05 17:17:21 You're right. I realized that the problem is only
+window.after = document.getElementById("after");
yosin_UTC9 2013/08/31 01:00:47 nit: var after =
+
+var sel = window.getSelection();
+sel.setBaseAndExtent(before, 0, before, 6);
+sel.modify("extend", "forward", "character");
+shouldBe("window.getSelection().focusNode == after", "true");
yosin_UTC9 2013/08/31 01:00:47 You can write shouldBe("sel.focusNode", "after")
dmazzoni 2013/09/05 07:57:29 This doesn't work unless "sel" is a global. As fa
yosin_UTC9 2013/09/05 08:42:48 eval() can see them. Here is working sample: http
+
+sel.setBaseAndExtent(after, 5, after, 0);
+sel.modify("extend", "backward", "character");
+shouldBe("window.getSelection().focusNode.parentElement == before", "true");
yosin_UTC9 2013/08/31 01:00:47 You can write shouldBe("sel.focusNode.paretElement
dmazzoni 2013/09/05 17:17:21 Done.
+</script>
+
+<script src="../../fast/js/resources/js-test-post.js"></script>
+</body>
+</html>

Powered by Google App Engine
This is Rietveld 408576698