diff options
author | Henri Sara <henri.sara@itmill.com> | 2011-02-24 12:07:14 +0000 |
---|---|---|
committer | Henri Sara <henri.sara@itmill.com> | 2011-02-24 12:07:14 +0000 |
commit | b1cd58ec2cac32e07d97469c41159c549d3d01cf (patch) | |
tree | 7a8087e64daf0d5dc2865f20c5f53703b19285c8 | |
parent | 07c08d6e9a624684f7839b2e3b3d8bad0c4eecd7 (diff) | |
download | vaadin-framework-b1cd58ec2cac32e07d97469c41159c549d3d01cf.tar.gz vaadin-framework-b1cd58ec2cac32e07d97469c41159c549d3d01cf.zip |
#6496 Close error notification with keyboard (Escape)
svn changeset:17431/svn branch:6.5
-rw-r--r-- | src/com/vaadin/terminal/gwt/client/ui/VNotification.java | 5 | ||||
-rw-r--r-- | tests/src/com/vaadin/tests/components/notification/CloseErrorNotificationWithEscape.html | 53 |
2 files changed, 58 insertions, 0 deletions
diff --git a/src/com/vaadin/terminal/gwt/client/ui/VNotification.java b/src/com/vaadin/terminal/gwt/client/ui/VNotification.java index 7e7ccf1791..bc0b0367bd 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/VNotification.java +++ b/src/com/vaadin/terminal/gwt/client/ui/VNotification.java @@ -9,6 +9,7 @@ import java.util.Date; import java.util.EventObject;
import java.util.Iterator;
+import com.google.gwt.event.dom.client.KeyCodes;
import com.google.gwt.user.client.DOM;
import com.google.gwt.user.client.Element;
import com.google.gwt.user.client.Event;
@@ -255,6 +256,10 @@ public class VNotification extends VOverlay { fade();
return false;
}
+ } else if (type == Event.ONKEYDOWN
+ && event.getKeyCode() == KeyCodes.KEY_ESCAPE) {
+ fade();
+ return false;
}
if (temporaryStyle == STYLE_SYSTEM) {
return true;
diff --git a/tests/src/com/vaadin/tests/components/notification/CloseErrorNotificationWithEscape.html b/tests/src/com/vaadin/tests/components/notification/CloseErrorNotificationWithEscape.html new file mode 100644 index 0000000000..c7efcc969a --- /dev/null +++ b/tests/src/com/vaadin/tests/components/notification/CloseErrorNotificationWithEscape.html @@ -0,0 +1,53 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> +<head profile="http://selenium-ide.openqa.org/profiles/test-case"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> +<link rel="selenium.base" href="" /> +<title>CloseErrorNotificationWithEscape</title> +</head> +<body> +<table cellpadding="1" cellspacing="1" border="1"> +<thead> +<tr><td rowspan="1" colspan="3">CloseErrorNotificationWithEscape</td></tr> +</thead><tbody> +<tr> + <td>open</td> + <td>/run/com.vaadin.tests.components.notification.Notifications?restartApplication</td> + <td></td> +</tr> +<tr> + <td>select</td> + <td>vaadin=runcomvaadintestscomponentsnotificationNotifications::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VNativeSelect[0]/domChild[0]</td> + <td>label=Error</td> +</tr> +<tr> + <td>click</td> + <td>vaadin=runcomvaadintestscomponentsnotificationNotifications::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[2]/VButton[0]/domChild[0]</td> + <td></td> +</tr> +<tr> + <td>assertText</td> + <td>vaadin=runcomvaadintestscomponentsnotificationNotifications::Root/VNotification[0]/HTML[0]/domChild[0]</td> + <td>Hello world</td> +</tr> +<tr> + <td>keyDown</td> + <td>vaadin=runcomvaadintestscomponentsnotificationNotifications::Root/VNotification[0]/HTML[0]/domChild[0]</td> + <td>\27</td> +</tr> +<!-- Fade delay is 400 ms by default - VNotification --> +<tr> + <td>pause</td> + <td>500</td> + <td></td> +</tr> +<tr> + <td>assertElementNotPresent</td> + <td>vaadin=runcomvaadintestscomponentsnotificationNotifications::Root/VNotification[0]</td> + <td></td> +</tr> + +</tbody></table> +</body> +</html> |