aboutsummaryrefslogtreecommitdiffstats
path: root/tests/unit/script/textinput.rs
diff options
context:
space:
mode:
authorPyfisch <pyfisch@gmail.com>2018-11-07 18:44:21 +0100
committerPyfisch <pyfisch@gmail.com>2018-11-07 18:58:51 +0100
commit7db13e93b7035384276b8c029ba9288ad453f01f (patch)
treeed35afa12834abc8050171c2aea016ef1323de6d /tests/unit/script/textinput.rs
parent9c7efd9151bff29192f40bcc0efec5a7e87a6a80 (diff)
downloadservo-7db13e93b7035384276b8c029ba9288ad453f01f.tar.gz
servo-7db13e93b7035384276b8c029ba9288ad453f01f.zip
Correct select all
Fixes assertion failure. Set selection direction forward on select all.
Diffstat (limited to 'tests/unit/script/textinput.rs')
-rw-r--r--tests/unit/script/textinput.rs10
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/unit/script/textinput.rs b/tests/unit/script/textinput.rs
index 73d99cf1588..f4e65a0e1d3 100644
--- a/tests/unit/script/textinput.rs
+++ b/tests/unit/script/textinput.rs
@@ -699,3 +699,13 @@ fn test_selection_bounds() {
assert_eq!(TextPoint { line: 0, index: 0 }, textinput.selection_start());
assert_eq!(TextPoint { line: 1, index: 0 }, textinput.selection_end());
}
+
+#[test]
+fn test_select_all() {
+ let mut textinput = text_input(Lines::Single, "abc");
+ textinput.set_selection_range(2, 3, SelectionDirection::Backward);
+ textinput.select_all();
+ assert_eq!(textinput.selection_direction(), SelectionDirection::Forward);
+ assert_eq!(TextPoint { line: 0, index: 0 }, textinput.selection_start());
+ assert_eq!(TextPoint { line: 0, index: 3 }, textinput.selection_end());
+}