aboutsummaryrefslogtreecommitdiffstats
path: root/tests/unit/script/textinput.rs
diff options
context:
space:
mode:
authorMatt Brubeck <mbrubeck@limpet.net>2016-04-01 12:24:49 -0700
committerMatt Brubeck <mbrubeck@limpet.net>2016-04-01 13:54:02 -0700
commitd7e6f8b0f15326aad413eb1c59fc57e913e309b4 (patch)
tree152e2b6a2f2f4738d1bb73ca2185f96ef6fcacc6 /tests/unit/script/textinput.rs
parent0397e2a24d3e5c988b089ef100002397f4cabdfa (diff)
downloadservo-d7e6f8b0f15326aad413eb1c59fc57e913e309b4.tar.gz
servo-d7e6f8b0f15326aad413eb1c59fc57e913e309b4.zip
Use correct byte indices in replace_selection
Diffstat (limited to 'tests/unit/script/textinput.rs')
-rw-r--r--tests/unit/script/textinput.rs9
1 files changed, 9 insertions, 0 deletions
diff --git a/tests/unit/script/textinput.rs b/tests/unit/script/textinput.rs
index 2613c0f640a..ee40c9ff50c 100644
--- a/tests/unit/script/textinput.rs
+++ b/tests/unit/script/textinput.rs
@@ -207,6 +207,15 @@ fn test_textinput_replace_selection() {
}
#[test]
+fn test_textinput_replace_selection_multibyte_char() {
+ let mut textinput = text_input(Lines::Single, "é");
+ textinput.adjust_horizontal_by_one(Direction::Forward, Selection::Selected);
+
+ textinput.replace_selection(DOMString::from("e"));
+ assert_eq!(textinput.get_content(), "e");
+}
+
+#[test]
fn test_textinput_current_line_length() {
let mut textinput = text_input(Lines::Multiple, "abc\nde\nf");
assert_eq!(textinput.current_line_length(), 3);