aboutsummaryrefslogtreecommitdiffstats
path: root/uitest/src/com/vaadin/tests/components/textfield/TextFieldMaxLengthRemovedFromDOM.java
blob: 28ff20c174085dfaa7a0f131b9295f81ee377104 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package com.vaadin.tests.components.textfield;

import com.vaadin.event.FieldEvents;
import com.vaadin.event.FieldEvents.FocusEvent;
import com.vaadin.tests.components.TestBase;
import com.vaadin.ui.TextField;

public class TextFieldMaxLengthRemovedFromDOM extends TestBase {

    @Override
    protected void setup() {
        final TextField tf = new TextField();
        tf.setMaxLength(11);
        tf.setRequired(true);
        tf.setImmediate(true);
        addComponent(tf);

        tf.addFocusListener(new FieldEvents.FocusListener() {

            public void focus(FocusEvent event) {
                // Resetting Max length should not remove maxlength attribute
                tf.setMaxLength(11);
            }
        });
    }

    @Override
    protected String getDescription() {
        return "Maxlength attribute should not dissappear from the DOM when I focus the text field.";
    }

    @Override
    protected Integer getTicketNumber() {
        return 9940;
    }

}