From: Leif Åstrand Date: Mon, 5 Sep 2011 12:27:06 +0000 (+0000) Subject: Test application for #7539 X-Git-Tag: 6.7.0.rc1~86 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=97b7f1244d75e42c14ac034de6712a4d42de3c22;p=vaadin-framework.git Test application for #7539 svn changeset:20846/svn branch:6.7 --- diff --git a/tests/src/com/vaadin/tests/components/FocusFromShortcutAction.java b/tests/src/com/vaadin/tests/components/FocusFromShortcutAction.java new file mode 100644 index 0000000000..124f2b9cdf --- /dev/null +++ b/tests/src/com/vaadin/tests/components/FocusFromShortcutAction.java @@ -0,0 +1,50 @@ +package com.vaadin.tests.components; + +import java.util.Arrays; + +import com.vaadin.event.ShortcutAction.KeyCode; +import com.vaadin.event.ShortcutAction.ModifierKey; +import com.vaadin.ui.Button; +import com.vaadin.ui.Button.ClickEvent; +import com.vaadin.ui.Select; +import com.vaadin.ui.TextField; + +public class FocusFromShortcutAction extends TestBase { + + @Override + protected void setup() { + final Select select = new Select("Select", Arrays.asList("Option 1", + "Option 2")); + final TextField text = new TextField("Text"); + + addComponent(select); + addComponent(text); + Button focusText = new Button("Focus text", new Button.ClickListener() { + public void buttonClick(ClickEvent event) { + text.focus(); + } + }); + focusText.setClickShortcut(KeyCode.T, ModifierKey.ALT); + + addComponent(focusText); + Button focusSelect = new Button("Focus select", + new Button.ClickListener() { + public void buttonClick(ClickEvent event) { + select.focus(); + } + }); + focusSelect.setClickShortcut(KeyCode.S, ModifierKey.ALT); + addComponent(focusSelect); + } + + @Override + protected String getDescription() { + return "The option drop down of the Focus select should not be opened when the \"Focus select\" button is triggered by clicking it with the mouse or with the associated shortcut key Alt + S"; + } + + @Override + protected Integer getTicketNumber() { + return Integer.valueOf(7539); + } + +}