mirror of
https://github.com/servo/servo.git
synced 2025-08-06 22:15:33 +01:00
Correct default selectionStart and selectionEnd
This commit is contained in:
parent
b517410a34
commit
87e7b1ee7a
7 changed files with 58 additions and 26 deletions
|
@ -494,10 +494,11 @@ fn test_textinput_set_content() {
|
|||
|
||||
assert_eq!(textinput.edit_point().line, 0);
|
||||
assert_eq!(textinput.edit_point().index, 0);
|
||||
|
||||
textinput.adjust_horizontal(3, Selection::Selected);
|
||||
assert_eq!(textinput.edit_point().line, 0);
|
||||
assert_eq!(textinput.edit_point().index, 3);
|
||||
textinput.set_content(DOMString::from("de"), true);
|
||||
textinput.set_content(DOMString::from("de"));
|
||||
assert_eq!(textinput.get_content(), "de");
|
||||
assert_eq!(textinput.edit_point().line, 0);
|
||||
assert_eq!(textinput.edit_point().index, 2);
|
||||
|
@ -634,6 +635,10 @@ fn test_textinput_unicode_handling() {
|
|||
fn test_selection_bounds() {
|
||||
let mut textinput = text_input(Lines::Single, "abcdef");
|
||||
|
||||
assert_eq!(TextPoint { line: 0, index: 0 }, textinput.selection_origin_or_edit_point());
|
||||
assert_eq!(TextPoint { line: 0, index: 0 }, textinput.selection_start());
|
||||
assert_eq!(TextPoint { line: 0, index: 0 }, textinput.selection_end());
|
||||
|
||||
textinput.set_selection_range(2, 5, SelectionDirection::Forward);
|
||||
assert_eq!(TextPoint { line: 0, index: 2 }, textinput.selection_origin_or_edit_point());
|
||||
assert_eq!(TextPoint { line: 0, index: 2 }, textinput.selection_start());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue