Skip to content

Commit

Permalink
Added test for issue #21
Browse files Browse the repository at this point in the history
  • Loading branch information
mstahv committed Nov 4, 2016
1 parent 02914c5 commit 51ea3e8
Showing 1 changed file with 45 additions and 0 deletions.
45 changes: 45 additions & 0 deletions src/test/java/org/vaadin/easyuploads/demoandtestapp/ClearTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
package org.vaadin.easyuploads.demoandtestapp;

import com.vaadin.data.Property;
import com.vaadin.ui.Button;
import com.vaadin.ui.Component;
import com.vaadin.ui.Notification;
import com.vaadin.ui.VerticalLayout;

import org.vaadin.easyuploads.*;

import org.vaadin.addonhelpers.AbstractTest;

public class ClearTest extends AbstractTest {

@Override
public Component getTestComponent() {
VerticalLayout layout = new VerticalLayout();
final UploadField uplDocument = new UploadField();
uplDocument.setButtonCaption("...Select File");
uplDocument.setDisplayUpload(false);

uplDocument.addValueChangeListener(new Property.ValueChangeListener() {
@Override
public void valueChange(Property.ValueChangeEvent event) {
Notification.show("File uploaded" + uplDocument.getLastFileName() + " IsEmpty:" + uplDocument.isEmpty());
}
});

layout.addComponent(uplDocument);

Button button = new Button("Test is clear + isEmtpy");
button.addClickListener(new Button.ClickListener() {
@Override
public void buttonClick(Button.ClickEvent event) {
uplDocument.clear();
Notification.show("IsEmpty: " + uplDocument.isEmpty());
}
});
layout.addComponent(button);

return layout;
}


}

0 comments on commit 51ea3e8

Please sign in to comment.