Skip to content
Permalink
Browse files

Adds a test for set_content to ignore max_length

  • Loading branch information
samfoo committed Dec 3, 2015
1 parent eecdfdf commit 419a26e6192a31478302c310910f1ae8f6f5e3ae
Showing with 10 additions and 0 deletions.
  1. +10 −0 tests/unit/script/textinput.rs
@@ -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(

0 comments on commit 419a26e

Please sign in to comment.
You can’t perform that action at this time.