Skip to content

Commit

Permalink
Adds a test for set_content to ignore max_length
Browse files Browse the repository at this point in the history
  • Loading branch information
samfoo committed Dec 3, 2015
1 parent eecdfdf commit 419a26e
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions tests/unit/script/textinput.rs
Expand Up @@ -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(
Expand Down

0 comments on commit 419a26e

Please sign in to comment.