Skip to content

Commit

Permalink
Bug 1880567 [wpt PR 44616] - [EditContext] Allow backwards range para…
Browse files Browse the repository at this point in the history
…ms in updateText, a=testonly

Automatic update from web-platform-tests
[EditContext] Allow backwards range params in updateText

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}

--

wpt-commits: 86be793cf4c65625e241ac179ad3093981832779
wpt-pr: 44616
  • Loading branch information
dandclark authored and moz-wptsync-bot committed Feb 22, 2024
1 parent 659cb95 commit 49a4513
Showing 1 changed file with 13 additions and 0 deletions.
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 49a4513

Please sign in to comment.