summaryrefslogtreecommitdiffstats
path: root/server
diff options
context:
space:
mode:
authorArtur Signell <artur@vaadin.com>2015-01-13 12:42:22 +0200
committerArtur Signell <artur@vaadin.com>2015-01-13 19:55:46 +0200
commit8eeeb35544522b96cba07795f336a14e2737c7ea (patch)
treed1d53b93ac00457f1b64858ee78f7f0832b1826a /server
parent2877e42f0dbf706d5b1c79e93ee16320b7b5d8cc (diff)
downloadvaadin-framework-8eeeb35544522b96cba07795f336a14e2737c7ea.tar.gz
vaadin-framework-8eeeb35544522b96cba07795f336a14e2737c7ea.zip
Fix remaining issues for NativeSelect blur/focus events (#6847)
* Do not spam focus/blur events to the server * Receive focus blur events no matter which constructor is used * Run test on all browsers Change-Id: I7d548397e6df3a375f9263c695a53c801d9c5c4a
Diffstat (limited to 'server')
-rw-r--r--server/src/com/vaadin/ui/NativeSelect.java3
-rw-r--r--server/tests/src/com/vaadin/ui/NativeSelectTest.java54
2 files changed, 57 insertions, 0 deletions
diff --git a/server/src/com/vaadin/ui/NativeSelect.java b/server/src/com/vaadin/ui/NativeSelect.java
index ee7bfc3e5c..137d57f677 100644
--- a/server/src/com/vaadin/ui/NativeSelect.java
+++ b/server/src/com/vaadin/ui/NativeSelect.java
@@ -56,14 +56,17 @@ public class NativeSelect extends AbstractSelect implements
public NativeSelect(String caption, Collection<?> options) {
super(caption, options);
+ registerRpc(focusBlurRpc);
}
public NativeSelect(String caption, Container dataSource) {
super(caption, dataSource);
+ registerRpc(focusBlurRpc);
}
public NativeSelect(String caption) {
super(caption);
+ registerRpc(focusBlurRpc);
}
/**
diff --git a/server/tests/src/com/vaadin/ui/NativeSelectTest.java b/server/tests/src/com/vaadin/ui/NativeSelectTest.java
new file mode 100644
index 0000000000..7e2a04ef1c
--- /dev/null
+++ b/server/tests/src/com/vaadin/ui/NativeSelectTest.java
@@ -0,0 +1,54 @@
+/*
+ * Copyright 2000-2014 Vaadin Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.vaadin.ui;
+
+import java.util.Collections;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+import com.vaadin.data.util.IndexedContainer;
+
+public class NativeSelectTest {
+
+ @Test
+ public void rpcRegisteredConstructorNoArg() {
+ assertFocusRpcRegistered(new NativeSelect());
+ }
+
+ @Test
+ public void rpcRegisteredConstructorString() {
+ assertFocusRpcRegistered(new NativeSelect("foo"));
+ }
+
+ @Test
+ public void rpcRegisteredConstructorStringCollection() {
+ assertFocusRpcRegistered(new NativeSelect("foo",
+ Collections.singleton("Hello")));
+ }
+
+ @Test
+ public void rpcRegisteredConstructorStringContainer() {
+ assertFocusRpcRegistered(new NativeSelect("foo", new IndexedContainer()));
+ }
+
+ private void assertFocusRpcRegistered(NativeSelect s) {
+ Assert.assertNotNull(
+ "RPC is not correctly registered",
+ s.getRpcManager("com.vaadin.shared.communication.FieldRpc$FocusAndBlurServerRpc"));
+ }
+
+}