diff --git a/src/main/java/org/htmlunit/html/HtmlElement.java b/src/main/java/org/htmlunit/html/HtmlElement.java index cfbe57775b..53e3548e3c 100644 --- a/src/main/java/org/htmlunit/html/HtmlElement.java +++ b/src/main/java/org/htmlunit/html/HtmlElement.java @@ -592,12 +592,8 @@ private Page type(final char c, final boolean lastType) } final WebClient webClient = page.getWebClient(); - if (this instanceof HtmlTextInput - || this instanceof HtmlTextArea - || this instanceof HtmlTelInput - || this instanceof HtmlNumberInput - || this instanceof HtmlSearchInput - || this instanceof HtmlPasswordInput) { + if (this instanceof HtmlSelectableTextInput + || this instanceof HtmlTextArea) { fireEvent(new KeyboardEvent(this, Event.TYPE_INPUT, c, shiftPressed_ || isShiftNeeded, ctrlPressed_, altPressed_)); } diff --git a/src/test/java/org/htmlunit/html/HtmlElementTest.java b/src/test/java/org/htmlunit/html/HtmlElementTest.java index 1e3fd8c37a..abd956b8a2 100644 --- a/src/test/java/org/htmlunit/html/HtmlElementTest.java +++ b/src/test/java/org/htmlunit/html/HtmlElementTest.java @@ -1269,4 +1269,27 @@ public void acceptChar() throws Exception { input.type(value); assertEquals(value, input.getValue()); } + + /** + * @throws Exception if an error occurs + */ + @Test + public void typeFiresInputEvent() throws Exception { + final String[] types = {"text", "tel", "number", "search", "password", "email", "url", "date", "time"}; + + for (final String type : types) { + final String html = DOCTYPE_HTML + + "\n" + + "\n" + + "\n" + + ""; + final HtmlPage page = loadPage(html); + page.getHtmlElementById("t").type("ab"); + assertEquals("input event for type=" + type, "inputinput", page.getTitleText()); + } + } }