summaryrefslogtreecommitdiffstats
path: root/uitest
diff options
context:
space:
mode:
authorArtur Signell <artur@vaadin.com>2015-08-04 00:16:04 +0300
committerpatrik <patrik@vaadin.com>2015-08-04 15:52:03 +0300
commit85796e463a5064b4584f42948394e241762984b9 (patch)
treeb93b64ff8e7f74bb605e9d676fa80b96769aaffb /uitest
parent3fe71f11c96105bb0fad1269e96eceec86711927 (diff)
downloadvaadin-framework-85796e463a5064b4584f42948394e241762984b9.tar.gz
vaadin-framework-85796e463a5064b4584f42948394e241762984b9.zip
Fix NPE when clicking and move handler is not set (#8718)
Change-Id: I6c4547eb716e64e60239d9d901b9b889cfcc3761
Diffstat (limited to 'uitest')
-rw-r--r--uitest/src/com/vaadin/tests/components/calendar/NullEventMoveHandler.java14
-rw-r--r--uitest/src/com/vaadin/tests/components/calendar/NullEventMoveHandlerTest.java15
2 files changed, 27 insertions, 2 deletions
diff --git a/uitest/src/com/vaadin/tests/components/calendar/NullEventMoveHandler.java b/uitest/src/com/vaadin/tests/components/calendar/NullEventMoveHandler.java
index c2dfdb26c1..40dd43abb2 100644
--- a/uitest/src/com/vaadin/tests/components/calendar/NullEventMoveHandler.java
+++ b/uitest/src/com/vaadin/tests/components/calendar/NullEventMoveHandler.java
@@ -5,17 +5,27 @@ import java.text.SimpleDateFormat;
import java.util.Locale;
import com.vaadin.server.VaadinRequest;
-import com.vaadin.tests.components.AbstractTestUI;
+import com.vaadin.tests.components.AbstractTestUIWithLog;
import com.vaadin.ui.Calendar;
import com.vaadin.ui.components.calendar.CalendarComponentEvents;
+import com.vaadin.ui.components.calendar.CalendarComponentEvents.EventClick;
+import com.vaadin.ui.components.calendar.CalendarComponentEvents.EventClickHandler;
import com.vaadin.ui.components.calendar.event.BasicEvent;
-public class NullEventMoveHandler extends AbstractTestUI {
+public class NullEventMoveHandler extends AbstractTestUIWithLog {
@Override
protected void setup(VaadinRequest request) {
Calendar calendar = getCalendar();
calendar.setHandler((CalendarComponentEvents.EventMoveHandler) null);
+ calendar.setHandler(new EventClickHandler() {
+
+ @Override
+ public void eventClick(EventClick event) {
+ log("Clicked on " + event.getCalendarEvent().getCaption());
+
+ }
+ });
addComponent(calendar);
}
diff --git a/uitest/src/com/vaadin/tests/components/calendar/NullEventMoveHandlerTest.java b/uitest/src/com/vaadin/tests/components/calendar/NullEventMoveHandlerTest.java
index c40cd9ce97..156100310c 100644
--- a/uitest/src/com/vaadin/tests/components/calendar/NullEventMoveHandlerTest.java
+++ b/uitest/src/com/vaadin/tests/components/calendar/NullEventMoveHandlerTest.java
@@ -3,6 +3,7 @@ package com.vaadin.tests.components.calendar;
import static org.hamcrest.core.Is.is;
import static org.junit.Assert.assertThat;
+import org.junit.Assert;
import org.junit.Test;
import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
@@ -23,11 +24,25 @@ public class NullEventMoveHandlerTest extends DndActionsTest {
}
@Test
+ public void eventIsClickableWhenNotMovableInMonthView() {
+ getEvent().click();
+ Assert.assertEquals("1. Clicked on foo", getLogRow(0));
+ }
+
+ @Test
public void eventIsNotMovableInWeekView() {
openWeekView();
assertEventCannotBeMoved();
}
+ @Test
+ public void eventIsClickableWhenNotMovableInWeekView() {
+ openWeekView();
+ getEvent().findElement(By.className("v-calendar-event-caption"))
+ .click();
+ Assert.assertEquals("1. Clicked on foo", getLogRow(0));
+ }
+
private void assertEventCannotBeMoved() {
int originalPosition = getEventXPosition();