diff options
author | Matt Brubeck <mbrubeck@limpet.net> | 2016-04-01 12:24:49 -0700 |
---|---|---|
committer | Matt Brubeck <mbrubeck@limpet.net> | 2016-04-01 13:54:02 -0700 |
commit | d7e6f8b0f15326aad413eb1c59fc57e913e309b4 (patch) | |
tree | 152e2b6a2f2f4738d1bb73ca2185f96ef6fcacc6 /tests/unit/script/textinput.rs | |
parent | 0397e2a24d3e5c988b089ef100002397f4cabdfa (diff) | |
download | servo-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.rs | 9 |
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); |