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

Unified Diff: third_party/WebKit/LayoutTests/editing/selection/set_base_and_extent/set_null.html

Issue 2466833002: selection.setBaseAndExtent with null should not crash. (Closed)
Patch Set: update Created 4 years 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/Source/core/editing/DOMSelection.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/LayoutTests/editing/selection/set_base_and_extent/set_null.html
diff --git a/third_party/WebKit/LayoutTests/editing/selection/set_base_and_extent/set_null.html b/third_party/WebKit/LayoutTests/editing/selection/set_base_and_extent/set_null.html
new file mode 100644
index 0000000000000000000000000000000000000000..cca44b4acc4891475eec3915e66ac9ec23e9cb12
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/editing/selection/set_base_and_extent/set_null.html
@@ -0,0 +1,38 @@
+<!doctype html>
+<script src="../../../resources/testharness.js"></script>
+<script src="../../../resources/testharnessreport.js"></script>
+<script src="../../assert_selection.js"></script>
+<div id="log"></div>
+<script>
+test(() => {
+assert_selection(
+ '<div>^foo|</div>',
+ selection => {
+ selection.setBaseAndExtent(null, 0, null, 0);
+ },
+ '<div>foo</div>',
+ 'Setting both null clears selection');
+
+assert_selection(
+ '<div>^foo|</div>',
+ selection => {
+ selection.setBaseAndExtent(null, 1, null, 2);
+ },
+ '<div>foo</div>',
+ 'Setting both null clears selection');
+
+assert_selection(
+ '<div>^foo|</div>',
+ selection => selection.setBaseAndExtent(null, 1, selection.document.querySelector('div'), 1),
+ '<div>foo</div>',
+ 'Setting only base null clears selection');
+
+assert_selection(
+ '<div>foo</div>',
+ selection => selection.setBaseAndExtent(selection.document.querySelector('div'), 0, null, 2),
+ '<div>|foo</div>',
+ 'Setting base non-null and extent null behaves as collapse.' +
+ 'This is under discussion: https://github.com/w3c/selection-api/issues/72');
+
+}, 'setBaseAndExtent with null.');
+</script>
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/editing/DOMSelection.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698