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

Unified Diff: third_party/WebKit/LayoutTests/editing/assert_selection.js

Issue 2114903002: [Editing][CodeHealth] Allow assert_selection have no anchor sample text. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: update Created 4 years, 6 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 | « third_party/WebKit/LayoutTests/editing/assert_selection.html ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/LayoutTests/editing/assert_selection.js
diff --git a/third_party/WebKit/LayoutTests/editing/assert_selection.js b/third_party/WebKit/LayoutTests/editing/assert_selection.js
index c615527057615aa8bb120fe1d2f4e71d7a901b91..6c506eac9586130ff48ded4b0c0c6d526efedf32 100644
--- a/third_party/WebKit/LayoutTests/editing/assert_selection.js
+++ b/third_party/WebKit/LayoutTests/editing/assert_selection.js
@@ -462,8 +462,6 @@ class Serializer {
* @param {!HTMLDocument} document
*/
serialize(document) {
- if (this.selection_.isNone)
- return document.body.firstChild.outerHTML;
this.serializeChildren(document.body);
return this.strings_.join('');
}
@@ -534,7 +532,7 @@ class Sample {
load(sampleText) {
const anchorMarker = sampleText.indexOf('^');
const focusMarker = sampleText.indexOf('|');
- if (focusMarker < 0) {
+ if (focusMarker < 0 && anchorMarker >= 0) {
throw new Error(`You should specify caret position in "${sampleText}".`);
}
if (focusMarker != sampleText.lastIndexOf('|')) {
« no previous file with comments | « third_party/WebKit/LayoutTests/editing/assert_selection.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698