Adds a test for set_content to ignore max_length

This commit is contained in:
Sam Gibson 2015-09-01 13:51:41 +12:00
parent eecdfdf6c1
commit 419a26e619

View file

@ -20,6 +20,16 @@ fn text_input(lines: Lines, s: &str) -> TextInput<DummyClipboardContext> {
TextInput::new(lines, DOMString::from(s), DummyClipboardContext::new(""), None)
}
#[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(