diff options
author | Teemu Suo-Anttila <teemusa@vaadin.com> | 2016-04-15 11:06:18 +0300 |
---|---|---|
committer | Teemu Suo-Anttila <teemusa@vaadin.com> | 2016-04-15 14:00:58 +0300 |
commit | 6b8412033e680ce6e5c7827ac504adf132305726 (patch) | |
tree | 0df05d16c324b285610af8910c126b58f4c490c5 /uitest/src/main/java/com/vaadin/tests/actions | |
parent | 9192b0bb5e5e699b506b3d3e7df4cf295fbea44a (diff) | |
download | vaadin-framework-6b8412033e680ce6e5c7827ac504adf132305726.tar.gz vaadin-framework-6b8412033e680ce6e5c7827ac504adf132305726.zip |
Build uitest war with maven
Change-Id: I32625901ca27a282253df44c6e776cf9632bacda
Diffstat (limited to 'uitest/src/main/java/com/vaadin/tests/actions')
-rw-r--r-- | uitest/src/main/java/com/vaadin/tests/actions/ActionsOnInvisibleComponents.java | 76 | ||||
-rw-r--r-- | uitest/src/main/java/com/vaadin/tests/actions/ActionsWithoutKeyCode.java | 39 |
2 files changed, 115 insertions, 0 deletions
diff --git a/uitest/src/main/java/com/vaadin/tests/actions/ActionsOnInvisibleComponents.java b/uitest/src/main/java/com/vaadin/tests/actions/ActionsOnInvisibleComponents.java new file mode 100644 index 0000000000..0f4c179cee --- /dev/null +++ b/uitest/src/main/java/com/vaadin/tests/actions/ActionsOnInvisibleComponents.java @@ -0,0 +1,76 @@ +package com.vaadin.tests.actions; + +import com.vaadin.event.ShortcutAction.KeyCode; +import com.vaadin.server.VaadinRequest; +import com.vaadin.tests.components.AbstractTestUIWithLog; +import com.vaadin.ui.Button; +import com.vaadin.ui.Button.ClickEvent; + +public class ActionsOnInvisibleComponents extends AbstractTestUIWithLog { + + private static final long serialVersionUID = -5993467736906948993L; + + @Override + protected void setup(VaadinRequest request) { + getContent().setId("test-root"); + log("'A' triggers a click on an invisible button"); + log("'B' triggers a click on a disabled button"); + log("'C' triggers a click on a visible and enabled button"); + + Button invisibleButton = new Button("Invisible button with shortcut"); + invisibleButton.setClickShortcut(KeyCode.A); + invisibleButton.addClickListener(new Button.ClickListener() { + @Override + public void buttonClick(ClickEvent event) { + log("Click event for invisible button"); + } + }); + + invisibleButton.setVisible(false); + addComponent(invisibleButton); + + Button disabledButton = new Button("Disabled button with shortcut"); + disabledButton.setClickShortcut(KeyCode.B); + disabledButton.addClickListener(new Button.ClickListener() { + @Override + public void buttonClick(ClickEvent event) { + log("Click event for disabled button"); + } + }); + + disabledButton.setEnabled(false); + addComponent(disabledButton); + + Button enabledButton = new Button("Enabled button with shortcut"); + enabledButton.setClickShortcut(KeyCode.C); + enabledButton.addClickListener(new Button.ClickListener() { + @Override + public void buttonClick(ClickEvent event) { + log("Click event for enabled button"); + } + }); + + addComponent(enabledButton); + } + + /* + * (non-Javadoc) + * + * @see com.vaadin.tests.components.AbstractTestUI#getTestDescription() + */ + @Override + protected String getTestDescription() { + return "Test to ensure actions are not performed on disabled/invisible components"; + } + + /* + * (non-Javadoc) + * + * @see com.vaadin.tests.components.AbstractTestUI#getTicketNumber() + */ + @Override + protected Integer getTicketNumber() { + return 12743; + } + +} diff --git a/uitest/src/main/java/com/vaadin/tests/actions/ActionsWithoutKeyCode.java b/uitest/src/main/java/com/vaadin/tests/actions/ActionsWithoutKeyCode.java new file mode 100644 index 0000000000..e94a4b1ade --- /dev/null +++ b/uitest/src/main/java/com/vaadin/tests/actions/ActionsWithoutKeyCode.java @@ -0,0 +1,39 @@ +package com.vaadin.tests.actions; + +import com.vaadin.event.Action; +import com.vaadin.server.VaadinRequest; +import com.vaadin.tests.components.AbstractTestUIWithLog; +import com.vaadin.ui.TextField; + +@SuppressWarnings("serial") +public class ActionsWithoutKeyCode extends AbstractTestUIWithLog { + + @Override + protected void setup(VaadinRequest request) { + TextField tf = new TextField(); + tf.setWidth("100%"); + tf.setInputPrompt("Enter text with å,ä or ä or press windows key while textfield is focused"); + addComponent(tf); + + addActionHandler(new Action.Handler() { + + private Action[] actions; + { + actions = new Action[] { new Action("test1") }; + } + + @Override + public Action[] getActions(Object target, Object sender) { + return actions; + } + + @Override + public void handleAction(Action action, Object sender, Object target) { + log("action " + action.getCaption() + " triggered by " + + sender.getClass().getSimpleName() + " on " + + target.getClass().getSimpleName()); + } + }); + } + +}
\ No newline at end of file |