aboutsummaryrefslogtreecommitdiffstats
path: root/tests/unit/script/textinput.rs
diff options
context:
space:
mode:
authorMatt Brubeck <mbrubeck@limpet.net>2016-03-24 14:22:49 -0700
committerMatt Brubeck <mbrubeck@limpet.net>2016-03-25 08:39:53 -0700
commitdb2c1841cbc5ecbc9ebc43f4cf85f12cf0c77ca8 (patch)
tree26b5ea54533fc499a73c99ce5f14daa2f3b9d1dc /tests/unit/script/textinput.rs
parentf2f05869d6ccd445df9b73e2e8d038c6cfa9e687 (diff)
downloadservo-db2c1841cbc5ecbc9ebc43f4cf85f12cf0c77ca8.tar.gz
servo-db2c1841cbc5ecbc9ebc43f4cf85f12cf0c77ca8.zip
Fix delete_char when selection range is empty
An empty selection range should be treated the same as no selection. Fixes browserhtml/browserhtml#930.
Diffstat (limited to 'tests/unit/script/textinput.rs')
-rw-r--r--tests/unit/script/textinput.rs7
1 files changed, 7 insertions, 0 deletions
diff --git a/tests/unit/script/textinput.rs b/tests/unit/script/textinput.rs
index c5071f36090..2613c0f640a 100644
--- a/tests/unit/script/textinput.rs
+++ b/tests/unit/script/textinput.rs
@@ -150,6 +150,13 @@ fn test_textinput_delete_char() {
textinput.delete_char(Direction::Forward);
// Not splitting surrogate pairs.
assert_eq!(textinput.get_content(), "ab");
+
+ let mut textinput = text_input(Lines::Single, "abcdefg");
+ textinput.adjust_horizontal(2, Selection::NotSelected);
+ // Set an empty selection range.
+ textinput.selection_begin = Some(textinput.edit_point);
+ textinput.delete_char(Direction::Backward);
+ assert_eq!(textinput.get_content(), "acdefg");
}
#[test]