There is a way to set max length on a textfield.it passes the test to me.
like this:

public class MyTextField extends TextField {

public MyTextField(){
InputElement...