aboutsummaryrefslogtreecommitdiffstats
path: root/tests/unit/script/textinput.rs
diff options
context:
space:
mode:
authorSam Gibson <sam@ifdown.net>2015-09-01 13:51:41 +1200
committerSam Gibson <sam@ifdown.net>2015-12-03 14:00:53 +1100
commit419a26e6192a31478302c310910f1ae8f6f5e3ae (patch)
treee00802c399781971e1632f8376c03a7867b024c0 /tests/unit/script/textinput.rs
parenteecdfdf6c17b71b03a9d6404d83de482880aa26c (diff)
downloadservo-419a26e6192a31478302c310910f1ae8f6f5e3ae.tar.gz
servo-419a26e6192a31478302c310910f1ae8f6f5e3ae.zip
Adds a test for set_content to ignore max_length
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 25ff3e827a0..75a49c824dc 100644
--- a/tests/unit/script/textinput.rs
+++ b/tests/unit/script/textinput.rs
@@ -21,6 +21,16 @@ fn text_input(lines: Lines, s: &str) -> TextInput<DummyClipboardContext> {
}
#[test]
+fn test_set_content_ignores_max_length() {
+ let mut textinput = TextInput::new(
+ Lines::Single, "".to_owned(), DummyClipboardContext::new(""), Some(1)
+ );
+
+ textinput.set_content("mozilla rocks".to_owned());
+ assert_eq!(textinput.get_content(), "mozilla rocks".to_owned());
+}
+
+#[test]
fn test_textinput_when_inserting_multiple_lines_over_a_selection_respects_max_length() {
let mut textinput = TextInput::new(
Lines::Multiple,