Use correct byte indices in replace_selection

This commit is contained in:
Matt Brubeck 2016-04-01 12:24:49 -07:00
parent 0397e2a24d
commit d7e6f8b0f1
2 changed files with 22 additions and 3 deletions

View file

@ -206,6 +206,15 @@ fn test_textinput_replace_selection() {
assert_eq!(textinput.get_content(), "abxyzefg");
}
#[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");