Skip to content

Commit

Permalink
[EditContext] Allow backwards range params in updateText
Browse files Browse the repository at this point in the history
Per w3c/edit-context#90,
EditContext.updateText() should allow the start/end parameters
to be backwards.

Bug: 40642681
Change-Id: Idde01fa7282120e0961eb60a9ccab58061f4062b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5301307
Reviewed-by: Anupam Snigdha <[email protected]>
Reviewed-by: Koji Ishii <[email protected]>
Commit-Queue: Dan Clark <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1261748}
  • Loading branch information
dandclark authored and chromium-wpt-export-bot committed Feb 16, 2024
1 parent 553ce34 commit d5b2a45
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions editing/edit-context/edit-context-basics.tentative.html
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,19 @@
assert_equals(editContext.selectionStart, 3);
assert_equals(editContext.selectionEnd, 0);
}, 'EditContext should allow a backwards selection');

test(function() {
const editContext = new EditContext();
assert_not_equals(editContext, null);
editContext.updateText(6, 0, "abcdef");
assert_equals(editContext.text, "abcdef");

editContext.updateText(2, 5, "ghi");
assert_equals(editContext.text, "abghif");

editContext.updateText(5, 2, "jkl");
assert_equals(editContext.text, "abjklf");
}, 'updateText can replace substrings including with backwards parameters');
</script>
</body>
</html>

0 comments on commit d5b2a45

Please sign in to comment.