summaryrefslogtreecommitdiffstats
path: root/uitest
diff options
context:
space:
mode:
authorDenis Anisimov <denis@vaadin.com>2016-09-28 13:24:42 +0300
committerDenis Anisimov <denis@vaadin.com>2016-10-03 09:00:48 +0300
commit43bb825f0e7fbaa3a1382f85c9b2f6f6c4fe3ac4 (patch)
tree6ba789759db22c0d8042c4ede8d91593b648ed7e /uitest
parentd6967afcbc87836464b39b22b2d424a336403952 (diff)
downloadvaadin-framework-43bb825f0e7fbaa3a1382f85c9b2f6f6c4fe3ac4.tar.gz
vaadin-framework-43bb825f0e7fbaa3a1382f85c9b2f6f6c4fe3ac4.zip
Migrating 7.7.1, 7.7.2, 7.7.3 to V8.
commit 11c3f8bd9ea65f7a7b8da9a282c31a127bd475a6 - Test and its UI class are added (both V8 and V7). Required functionality should be available via modern GWT version. commit 729dbf96fe76e7627168ab2c9d1d71c4eb7214c8 - About update release notes. No need to be included. commit 675f38349c43ac45dae40cf33a7b1fd0f8f261ca - V8 already contains correct Import-Packages section which uses osgi.javax.servlet.version variable whise version is 3.0.0 at the moment. commit 5da7c052f55cb4703b74f38f5bb19fc3f3fa2a76 - Use Vaadin plugin 7.7.0 from 7.7.0.alpha1. Is not applicable. commit 1df80001ab6c916effa917781dba652d09d01056 - Updated tutorial to Vaadin 7.7.0. Is not applicable. The tutorial already contains correct links and updated source code snippets. commit 8b4f0ed8a894b04902a5d4258119dcdc8e76d1e0 - set-property-fallback name="user.agent" value="safari". Is already there. commit 28ed04e827669cc4dd329331dac9699bd93f70bc - Fix animation end listeners so they are always removed. Is already there. commit 408253bc3f8bd3975f0525ce6832be214a3552e9 - Use servlet context classloader when finding servlet class for websockets. Is already there. commit 7a6f250d89474849648ed2ee96a6bfb78c3b9ca8 - Fire actions before removing menu from the DOM. Is already there. commit 9b66c6eb9bebf657d3f2def8c767e0e9d51cc92c - Do not run test on IE8 as IE8 is broken. Transplanted. commit 3faa43ff39ecda56587b93f0c5e262a2907871a7 - Discard for DateField when the data source contains null. It is not applicable for V8 (There is no anymore discard method in DateField (and no datasource suport in field)). Transplanted for DateField in compatibility. commit e0c1f91a3d6d1884e07ce8d1ba957aff6a9bf29a - Fix ComboBox paging when number of items equals page length. It's already done by another fix which replaced ComboBox in compatibility package to the V7 version. commit 83a1b8a0961cc9b2d43e01757530cefd035b0a22 - Update DOM and update escalator row count in the correct order. Transplanted. commit 45f2fba8ff7a4b62680618a325d4afcebfb7a1e9 - Prevent editor from being canceled while it is being saved. Transplanted to compatibility package. Is not applicable to modern Grid. commit ad67f7f43afb0feec5e029aea90297f2abe4f2c1 - Delete broken stylesheet and revert to default style until a new stylesheet is created. Is already there. commit c970a78d42a2d8f1745df7a11a74f3731f8be9a5 - Always show loading indicator for JavaScript RPC. Transplanted. commit 2aad3416061586f7e2649160bd832eefe03702ad - Make test independent of any converters present in the factory. It's already there. commit c9ad48430be135d18fe9f30868e091dd51c57b94 - Do not include yuicompressor for Sass compiler. Transplanted. Exclusion is added into vaadin/pom.xml commit 52d01a68e91ce73306b3a1747af97e928048ecdf - Test for Firefox download disconnecting push channel. Transplanted. commit 4bc375d1d21f468e6433da3a183150e0bfe0cae4 - Handle encoded URL characters correctly when constructing widget set name. Transplanted. commit 17ba88eaf87e15e6f3c729e5c7f8e875d5f86d8d - Update version to 7.7-SNAPSHOT. Is not applicable. commit 47b7b13e5c959de3bd925693b074d85e7625a87e - Ensure Firefox always updates the grid scrollbar. Transplanted. Made changes in the logic to the test for modern Grid component. commit 4d851ba21d1b8f35685b631d2845731f8fb33252 - Calculate column widths immediately if there is data. Transplanted to both client side modules. commit 8f0b1a1dd026a756912c9f21bd2b34ea46897c7f - Skip Maven enforcer plugin during demo validation. Transplanted (one build file is affected). commit 62815353e1b9d3cd126809f5c818ad35bf913807 - Build demos from 7.7 branch (now for master branch). FW8 demos are added (one build file is affected). commit 815d72115d5aaf3676daefd5642115577e4151ef - Make test pass on all browsers. Transplanted to both V7 and V8 version tests. commit 516c428ca127e3c31b7b4d74220e4b7eed4571be - Use widget set specified by init parameter. Transplanted to the one UIProvider class. commit b00c580ed70f682a42afbfa91f978921bb86c2cd - Use correct column index when calculating min width during resize. Transplanted into both client side classes (main and compatibility) as is. Test for V7 is transplanted as is. Test for V8 is written from scratch based on V7 version. commit 7dd91cf057eb06a09009096a8278f34aad9bd8d9 - Fix regression that broke widget set compilation in 7.7.1. It's already there. commit c665731b0b97b697e80c47955d3558c19f0c81cb - Ensure temporary layout manager state is cleared at the end of a layout phase. Transplanted to the one LayoutManager class. commit 57a965251afdb5ee9ac1913a0101d854d8215aa6 - Fix assertion error when column widths are calculated. Transplanted to both versions of the client Grid widget. commit c5c52684eb30d924cb75a632b526a0f879d5a33c - Format Java files using Eclipse Neon and Vaadin settings. Only formatting changes. Is not transplanted. f5d06d877165bf413ec71c4fc88cf46c8c57a372 - Change javadoc to a style Eclipse formatter can handle. Transplanted to both versions of the client Grid widget. commit 6033e13c20b3d6e8b6f5add0f786d5ab2e1bb3fe - Make initially disabled grid work when enabled. Transplanted to both client side modules. commit a2d6e4fb4b1fd13e9a1b88f2ab1b78d14d8b64a9 - Use requestAnimationFrame when scrolling in Grid. Transplanted to both client side modules. commit fe9438e7b77c606855cfd739dd7e30b3f8cd4165 - Specify branch also for Sampler. Is not applicable for master branch. commit 1ec5d8ef7cb8bbd82bae1c9b79a376a5dca28f48 - Update to Chrome 53. Is already there. commit 961851bfbc4844474299433c34af6c9e4323d891 - Updated link to new step 1 video in tutorial. Is already there. commit 41dc2fe1611adc70d00e6f77debb2a6d4dcdefb0 - Revert "Use widget set specified by init parameter. Transplanted to the one UIProvider class. commit 092b4f7f3192555fe3ae22ac03a89ac2ada2a2dd - Use widget set specified by init parameter. Transplanted to the common server side classes. commit 977cec7e3107c2da306d46449dbf32f6544313be - Fix widget set builder to create widget set in correct location. Transplanted to the one ClassPathExplorer class file. commit 6c12ad89ea1064cd4cc0456baca5ee00ae76d032 - Format project pom files using correct settings. Is not transplanted: only formatting changes for POM files. commit 0aad93ecc1ce743dffc093ce7ae2ef88831f6073 - Add tests for widgetset compilation in different modes. Transplanted. New test projects. commit 0a3a1ef8321ed421be2337034fdb1cae2c434c3d - Use versions-maven-plugin 2.3 to avoid NPE while setting project version. Is already there. Change-Id: Ie3a5088f25de1772f01ea30c4a5eba0b169ee0ab
Diffstat (limited to 'uitest')
-rw-r--r--uitest/src/main/java/com/vaadin/tests/components/grid/GridApplyFilterWhenScrolledDown.java44
-rw-r--r--uitest/src/main/java/com/vaadin/tests/components/grid/GridColumnHiding.java6
-rw-r--r--uitest/src/main/java/com/vaadin/tests/components/grid/InitiallyDisabledGrid.java58
-rw-r--r--uitest/src/main/java/com/vaadin/tests/components/javascriptcomponent/JSComponentLoadingIndicator.java38
-rw-r--r--uitest/src/main/java/com/vaadin/tests/core/SpecialCharactersEncodingUI.java30
-rw-r--r--uitest/src/main/java/com/vaadin/tests/resources/DownloadWithPush.java93
-rw-r--r--uitest/src/main/java/com/vaadin/tests/widgetset/client/v7/grid/GridCellFocusOnResetSizeWidget.java5
-rw-r--r--uitest/src/main/java/com/vaadin/tests/widgetset/client/v7/grid/GridClientColumnRendererConnector.java18
-rw-r--r--uitest/src/main/java/com/vaadin/v7/tests/components/datefield/DateFieldDiscardValue.java99
-rw-r--r--uitest/src/main/java/com/vaadin/v7/tests/components/grid/GridApplyFilterWhenScrolledDown.java64
-rw-r--r--uitest/src/main/java/com/vaadin/v7/tests/components/grid/InitiallyDisabledGrid.java60
-rw-r--r--uitest/src/main/java/com/vaadin/v7/tests/components/grid/basicfeatures/GridBasicFeatures.java9
-rw-r--r--uitest/src/main/java/com/vaadin/v7/tests/core/SpecialCharactersEncodingUI.java30
-rw-r--r--uitest/src/main/resources/com/vaadin/tests/components/javascriptcomponent/JSComponent.js11
-rw-r--r--uitest/src/test/java/com/vaadin/tests/components/grid/GridApplyFilterWhenScrolledDownTest.java44
-rw-r--r--uitest/src/test/java/com/vaadin/tests/components/grid/GridColumnHidingTest.java40
-rw-r--r--uitest/src/test/java/com/vaadin/tests/components/grid/InitiallyDisabledGridTest.java45
-rw-r--r--uitest/src/test/java/com/vaadin/tests/components/javascriptcomponent/JSComponentLoadingIndicatorTest.java29
-rw-r--r--uitest/src/test/java/com/vaadin/tests/components/tabsheet/TabsheetScrollIntoViewTest.java11
-rw-r--r--uitest/src/test/java/com/vaadin/tests/core/SpecialCharactersEncodingUITest.java37
-rw-r--r--uitest/src/test/java/com/vaadin/v7/tests/components/datefield/DateFieldDiscardValueTest.java85
-rw-r--r--uitest/src/test/java/com/vaadin/v7/tests/components/grid/GridApplyFilterWhenScrolledDownTest.java44
-rw-r--r--uitest/src/test/java/com/vaadin/v7/tests/components/grid/InitiallyDisabledGridTest.java34
-rw-r--r--uitest/src/test/java/com/vaadin/v7/tests/components/grid/basicfeatures/server/GridColumnResizeTest.java21
-rw-r--r--uitest/src/test/java/com/vaadin/v7/tests/components/grid/basicfeatures/server/GridColumnVisibilityTest.java35
-rw-r--r--uitest/src/test/java/com/vaadin/v7/tests/core/SpecialCharactersEncodingUITest.java37
26 files changed, 1020 insertions, 7 deletions
diff --git a/uitest/src/main/java/com/vaadin/tests/components/grid/GridApplyFilterWhenScrolledDown.java b/uitest/src/main/java/com/vaadin/tests/components/grid/GridApplyFilterWhenScrolledDown.java
new file mode 100644
index 0000000000..72a53d2f0c
--- /dev/null
+++ b/uitest/src/main/java/com/vaadin/tests/components/grid/GridApplyFilterWhenScrolledDown.java
@@ -0,0 +1,44 @@
+package com.vaadin.tests.components.grid;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.function.Function;
+
+import com.vaadin.annotations.Theme;
+import com.vaadin.server.VaadinRequest;
+import com.vaadin.server.data.DataSource;
+import com.vaadin.tests.components.AbstractTestUI;
+import com.vaadin.ui.Button;
+import com.vaadin.ui.Grid;
+
+@Theme("valo")
+public class GridApplyFilterWhenScrolledDown extends AbstractTestUI {
+
+ @Override
+ protected void setup(VaadinRequest request) {
+ Grid<String> grid = new Grid<>();
+
+ grid.addColumn("Name", Function.identity());
+
+ List<String> data = new ArrayList<>();
+ for (int i = 0; i < 1000; i++) {
+ data.add("Name " + i);
+ }
+
+ data.add("Test");
+ grid.setItems(data);
+
+ addComponent(grid);
+ Button button = new Button("Filter Test item",
+ event -> filter(grid.getDataSource(), data));
+ addComponent(button);
+ }
+
+ private void filter(DataSource<String> dataSource, List<String> data) {
+ String last = data.get(data.size() - 1);
+ data.clear();
+ data.add(last);
+ dataSource.refreshAll();
+ }
+
+} \ No newline at end of file
diff --git a/uitest/src/main/java/com/vaadin/tests/components/grid/GridColumnHiding.java b/uitest/src/main/java/com/vaadin/tests/components/grid/GridColumnHiding.java
index 7fa86b6522..0abf48baeb 100644
--- a/uitest/src/main/java/com/vaadin/tests/components/grid/GridColumnHiding.java
+++ b/uitest/src/main/java/com/vaadin/tests/components/grid/GridColumnHiding.java
@@ -41,10 +41,14 @@ public class GridColumnHiding extends AbstractTestUI {
grid.addColumnVisibilityChangeListener(event -> visibilityChangeLabel
.setValue(event.getColumn().isHidden() + ""));
+ Button toggleHidden = new Button("Toggle all column hidden state",
+ event -> grid.getColumns().forEach(
+ column -> column.setHidden(!column.isHidden())));
+
grid.setItems(Arrays.asList(Person.createTestPerson1(),
Person.createTestPerson2()));
addComponents(grid, toggleNameColumn, toggleAgeColumn,
- toggleEmailColumn, visibilityChangeLabel);
+ toggleEmailColumn, visibilityChangeLabel, toggleHidden);
}
}
diff --git a/uitest/src/main/java/com/vaadin/tests/components/grid/InitiallyDisabledGrid.java b/uitest/src/main/java/com/vaadin/tests/components/grid/InitiallyDisabledGrid.java
new file mode 100644
index 0000000000..74f69ef7ab
--- /dev/null
+++ b/uitest/src/main/java/com/vaadin/tests/components/grid/InitiallyDisabledGrid.java
@@ -0,0 +1,58 @@
+package com.vaadin.tests.components.grid;
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+import com.vaadin.server.VaadinRequest;
+import com.vaadin.tests.data.bean.Person;
+import com.vaadin.ui.Button;
+import com.vaadin.ui.Grid;
+import com.vaadin.ui.UI;
+import com.vaadin.ui.VerticalLayout;
+
+public class InitiallyDisabledGrid extends UI {
+
+ @Override
+ protected void init(VaadinRequest request) {
+ VerticalLayout layout = new VerticalLayout();
+ setContent(layout);
+ layout.setSizeFull();
+ layout.setWidth("600px");
+ layout.setHeight("600px");
+ final Grid<Person> grid = createGrid();
+ Button button = new Button("Enable/Disable",
+ event -> grid.setEnabled(!grid.isEnabled()));
+
+ layout.addComponent(button);
+ VerticalLayout l = new VerticalLayout();
+ l.setSizeFull();
+ l.addComponent(grid);
+
+ layout.addComponent(l);
+ layout.setExpandRatio(l, 1.0f);
+ }
+
+ private Grid<Person> createGrid() {
+ // Have some data
+ Collection<Person> people = new ArrayList<>();
+ for (int i = 0; i < 100; i++) {
+ Person person = new Person();
+ person.setFirstName("First " + i);
+ person.setLastName("Last " + i);
+ people.add(person);
+ }
+ // Have a container of some type to contain the data
+
+ // Create a grid bound to the container
+ Grid<Person> grid = new Grid<>();
+ grid.setSizeFull();
+ grid.setItems(people);
+ grid.addColumn("firstName", Person::getFirstName);
+ grid.addColumn("lastNAme", Person::getLastName);
+
+ grid.setEnabled(false);
+
+ return grid;
+ }
+
+} \ No newline at end of file
diff --git a/uitest/src/main/java/com/vaadin/tests/components/javascriptcomponent/JSComponentLoadingIndicator.java b/uitest/src/main/java/com/vaadin/tests/components/javascriptcomponent/JSComponentLoadingIndicator.java
new file mode 100644
index 0000000000..d318b7e5b0
--- /dev/null
+++ b/uitest/src/main/java/com/vaadin/tests/components/javascriptcomponent/JSComponentLoadingIndicator.java
@@ -0,0 +1,38 @@
+package com.vaadin.tests.components.javascriptcomponent;
+
+import com.vaadin.annotations.JavaScript;
+import com.vaadin.server.VaadinRequest;
+import com.vaadin.tests.components.AbstractTestUI;
+import com.vaadin.ui.AbstractJavaScriptComponent;
+import com.vaadin.ui.JavaScriptFunction;
+import com.vaadin.ui.Label;
+
+import elemental.json.JsonArray;
+
+public class JSComponentLoadingIndicator extends AbstractTestUI {
+
+ @JavaScript({ "JSComponent.js" })
+ public class JSComponent extends AbstractJavaScriptComponent {
+ public JSComponent() {
+ addFunction("test", new JavaScriptFunction() {
+ @Override
+ public void call(JsonArray arguments) {
+ try {
+ Thread.sleep(1000);
+ Label label = new Label("pong");
+ label.addStyleName("pong");
+ addComponent(label);
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+ });
+ }
+ }
+
+ @Override
+ protected void setup(VaadinRequest request) {
+ addComponent(new JSComponent());
+ }
+
+} \ No newline at end of file
diff --git a/uitest/src/main/java/com/vaadin/tests/core/SpecialCharactersEncodingUI.java b/uitest/src/main/java/com/vaadin/tests/core/SpecialCharactersEncodingUI.java
new file mode 100644
index 0000000000..974d94c03b
--- /dev/null
+++ b/uitest/src/main/java/com/vaadin/tests/core/SpecialCharactersEncodingUI.java
@@ -0,0 +1,30 @@
+package com.vaadin.tests.core;
+
+import com.vaadin.server.VaadinRequest;
+import com.vaadin.tests.components.AbstractTestUI;
+import com.vaadin.ui.Label;
+import com.vaadin.ui.MenuBar;
+import com.vaadin.ui.TextField;
+
+public class SpecialCharactersEncodingUI extends AbstractTestUI {
+
+ public static String textWithZwnj = "\ufeffछुट्‌याउनेछन् क्ष क्‌ष क्‍ष";
+
+ @Override
+ protected void setup(VaadinRequest request) {
+ MenuBar menubar = new MenuBar();
+ menubar.setId("menubar");
+ addComponent(menubar);
+ menubar.addItem(textWithZwnj, null);
+
+ Label label = new Label(textWithZwnj);
+ label.setId("label");
+ addComponent(label);
+
+ TextField f = new TextField("Textfield", textWithZwnj);
+ f.setId("textfield");
+ addComponent(f);
+
+ }
+
+} \ No newline at end of file
diff --git a/uitest/src/main/java/com/vaadin/tests/resources/DownloadWithPush.java b/uitest/src/main/java/com/vaadin/tests/resources/DownloadWithPush.java
new file mode 100644
index 0000000000..f3d21950f9
--- /dev/null
+++ b/uitest/src/main/java/com/vaadin/tests/resources/DownloadWithPush.java
@@ -0,0 +1,93 @@
+package com.vaadin.tests.resources;
+
+import java.io.IOException;
+import java.io.InputStream;
+
+import com.vaadin.annotations.Push;
+import com.vaadin.server.DownloadStream;
+import com.vaadin.server.Resource;
+import com.vaadin.server.StreamResource;
+import com.vaadin.server.StreamResource.StreamSource;
+import com.vaadin.server.VaadinRequest;
+import com.vaadin.tests.components.AbstractTestUIWithLog;
+import com.vaadin.ui.Button;
+import com.vaadin.ui.Button.ClickEvent;
+
+@Push
+public class DownloadWithPush extends AbstractTestUIWithLog {
+
+ private static class GeneratedStream extends InputStream {
+ int read = 0;
+ int next = 'a';
+ private final int size;
+
+ public GeneratedStream(int size) {
+ this.size = size;
+ }
+
+ @Override
+ public int read() throws IOException {
+ if (available() == 0) {
+ return -1;
+ }
+
+ read++;
+ next++;
+ if (next > 'z') {
+ next = 'a';
+ }
+ return next;
+ }
+
+ @Override
+ public int available() throws IOException {
+ return size - read;
+ }
+ }
+
+ private final class DownloadResoure extends StreamResource {
+ private DownloadResoure(StreamSource streamSource, String filename) {
+ super(streamSource, filename);
+ }
+
+ @Override
+ public DownloadStream getStream() {
+ DownloadStream ds = super.getStream();
+ ds.setParameter("Content-Disposition",
+ "attachment; filename=" + getFilename() + ";");
+ return ds;
+ }
+ }
+
+ private Resource hugeFileResource = createResource();;
+ private int fileSize = 300 * (1024 * 1024);
+
+ @Override
+ protected void setup(VaadinRequest request) {
+ Button b = new Button("Download a "
+ + String.format("%.1f", fileSize / 1024.0 / 1024.0) + "MB file",
+ new Button.ClickListener() {
+ @Override
+ public void buttonClick(ClickEvent event) {
+ getUI().getPage().open(hugeFileResource, "", false);
+ }
+ });
+ addComponent(b);
+ }
+
+ private Resource createResource() {
+ Resource hugeFileResource = new DownloadResoure(new StreamSource() {
+ @Override
+ public InputStream getStream() {
+ return new GeneratedStream(fileSize);
+ }
+ }, "hugefile.txt");
+ return hugeFileResource;
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return 19709;
+ }
+
+} \ No newline at end of file
diff --git a/uitest/src/main/java/com/vaadin/tests/widgetset/client/v7/grid/GridCellFocusOnResetSizeWidget.java b/uitest/src/main/java/com/vaadin/tests/widgetset/client/v7/grid/GridCellFocusOnResetSizeWidget.java
index 0fe861f723..d2dbf78739 100644
--- a/uitest/src/main/java/com/vaadin/tests/widgetset/client/v7/grid/GridCellFocusOnResetSizeWidget.java
+++ b/uitest/src/main/java/com/vaadin/tests/widgetset/client/v7/grid/GridCellFocusOnResetSizeWidget.java
@@ -81,6 +81,11 @@ public class GridCellFocusOnResetSizeWidget
}
handler.resetDataAndSize(size);
}
+
+ @Override
+ public boolean isWaitingForData() {
+ return false;
+ }
}
private class Col extends Grid.Column<String, String[]> {
diff --git a/uitest/src/main/java/com/vaadin/tests/widgetset/client/v7/grid/GridClientColumnRendererConnector.java b/uitest/src/main/java/com/vaadin/tests/widgetset/client/v7/grid/GridClientColumnRendererConnector.java
index 904ecbf1d5..e4dce67da8 100644
--- a/uitest/src/main/java/com/vaadin/tests/widgetset/client/v7/grid/GridClientColumnRendererConnector.java
+++ b/uitest/src/main/java/com/vaadin/tests/widgetset/client/v7/grid/GridClientColumnRendererConnector.java
@@ -69,6 +69,7 @@ public class GridClientColumnRendererConnector
private int numberOfRows;
private DataChangeHandler dataChangeHandler;
private int latency;
+ private Timer timer;
public DelayedDataSource(DataSource<String> ds, int latency) {
this.ds = ds;
@@ -78,7 +79,7 @@ public class GridClientColumnRendererConnector
@Override
public void ensureAvailability(final int firstRowIndex,
final int numberOfRows) {
- new Timer() {
+ timer = new Timer() {
@Override
public void run() {
@@ -87,8 +88,10 @@ public class GridClientColumnRendererConnector
dataChangeHandler.dataUpdated(firstRowIndex, numberOfRows);
dataChangeHandler.dataAvailable(firstRowIndex,
numberOfRows);
+ timer = null;
}
- }.schedule(latency);
+ };
+ timer.schedule(latency);
}
@Override
@@ -117,6 +120,11 @@ public class GridClientColumnRendererConnector
// TODO Auto-generated method stub (henrik paul: 17.6.)
return null;
}
+
+ @Override
+ public boolean isWaitingForData() {
+ return timer != null;
+ }
}
@Override
@@ -211,8 +219,7 @@ public class GridClientColumnRendererConnector
@SuppressWarnings("unchecked")
public void triggerClientSortingTest() {
Grid<String> grid = getWidget();
- ListSorter<String> sorter = new ListSorter<>(
- grid);
+ ListSorter<String> sorter = new ListSorter<>(grid);
// Make sorter sort the numbers in natural order
sorter.setComparator(
@@ -236,8 +243,7 @@ public class GridClientColumnRendererConnector
@SuppressWarnings("unchecked")
public void shuffle() {
Grid<String> grid = getWidget();
- ListSorter<String> shuffler = new ListSorter<>(
- grid);
+ ListSorter<String> shuffler = new ListSorter<>(grid);
// Make shuffler return random order
shuffler.setComparator(
diff --git a/uitest/src/main/java/com/vaadin/v7/tests/components/datefield/DateFieldDiscardValue.java b/uitest/src/main/java/com/vaadin/v7/tests/components/datefield/DateFieldDiscardValue.java
new file mode 100644
index 0000000000..2119b9f21e
--- /dev/null
+++ b/uitest/src/main/java/com/vaadin/v7/tests/components/datefield/DateFieldDiscardValue.java
@@ -0,0 +1,99 @@
+package com.vaadin.v7.tests.components.datefield;
+
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+
+import com.vaadin.server.VaadinRequest;
+import com.vaadin.tests.components.AbstractTestUI;
+import com.vaadin.ui.Button;
+import com.vaadin.ui.Button.ClickEvent;
+import com.vaadin.ui.Button.ClickListener;
+import com.vaadin.ui.HorizontalLayout;
+import com.vaadin.ui.VerticalLayout;
+import com.vaadin.v7.data.util.ObjectProperty;
+import com.vaadin.v7.ui.DateField;
+
+/**
+ * Test to demonstrate how discarding of field value works with various valid
+ * and invalid data sources. Previously (Ticket #8069) the case where the
+ * content of the datasource was null was not handled correctly. This value is a
+ * valid data source value for the field, but discard did not actually discard
+ * the value or remove error markers in this cases.
+ *
+ * @author Vaadin Ltd
+ *
+ */
+public class DateFieldDiscardValue extends AbstractTestUI {
+
+ public static final String PROP_NONULL = "A field with a valid date in the data source property";
+ public static final String PROP_NULL_VALUE = "A field with a null value in the data source property";
+ public static final String PROP_NULL = "A field with a null datasource property";
+
+ @Override
+ protected void setup(VaadinRequest request) {
+ String dateFormat = "dd/MM/yy";
+
+ final DateField df = new DateField(PROP_NONULL);
+ df.setDateFormat(dateFormat);
+ df.setBuffered(true);
+ Date date = null;
+ try {
+ date = new SimpleDateFormat(dateFormat).parse("25/07/16");
+ } catch (ParseException e1) {
+ // This cannot happen
+ }
+ ObjectProperty<Date> prop = new ObjectProperty<>(date, Date.class);
+ df.setPropertyDataSource(prop);
+ Button button = new Button("Discard 1");
+ button.addClickListener(new ClickListener() {
+
+ @Override
+ public void buttonClick(ClickEvent event) {
+ df.discard();
+ }
+
+ });
+ VerticalLayout layout = new VerticalLayout();
+ HorizontalLayout hLayout = new HorizontalLayout(df, button);
+ layout.addComponent(hLayout);
+
+ final DateField df1 = new DateField(PROP_NULL_VALUE);
+ df1.setDateFormat(dateFormat);
+ df1.setBuffered(true);
+
+ prop = new ObjectProperty<>(null, Date.class);
+ df1.setPropertyDataSource(prop);
+ button = new Button("Discard 2");
+ button.addClickListener(new ClickListener() {
+
+ @Override
+ public void buttonClick(ClickEvent event) {
+ df1.discard();
+ }
+
+ });
+ hLayout = new HorizontalLayout(df1, button);
+ layout.addComponent(hLayout);
+
+ final DateField df2 = new DateField(PROP_NULL);
+ df2.setDateFormat(dateFormat);
+ df2.setBuffered(true);
+ df2.setPropertyDataSource(null);
+ button = new Button("Discard 3");
+ button.addClickListener(new ClickListener() {
+
+ @Override
+ public void buttonClick(ClickEvent event) {
+ df2.discard();
+ }
+
+ });
+ hLayout = new HorizontalLayout(df2, button);
+ layout.addComponent(hLayout);
+
+ setContent(layout);
+
+ }
+
+} \ No newline at end of file
diff --git a/uitest/src/main/java/com/vaadin/v7/tests/components/grid/GridApplyFilterWhenScrolledDown.java b/uitest/src/main/java/com/vaadin/v7/tests/components/grid/GridApplyFilterWhenScrolledDown.java
new file mode 100644
index 0000000000..08a621c937
--- /dev/null
+++ b/uitest/src/main/java/com/vaadin/v7/tests/components/grid/GridApplyFilterWhenScrolledDown.java
@@ -0,0 +1,64 @@
+package com.vaadin.v7.tests.components.grid;
+
+import com.vaadin.annotations.Theme;
+import com.vaadin.server.VaadinRequest;
+import com.vaadin.ui.UI;
+import com.vaadin.ui.themes.ValoTheme;
+import com.vaadin.v7.data.Container.Filterable;
+import com.vaadin.v7.data.Item;
+import com.vaadin.v7.data.util.filter.SimpleStringFilter;
+import com.vaadin.v7.event.FieldEvents.TextChangeEvent;
+import com.vaadin.v7.event.FieldEvents.TextChangeListener;
+import com.vaadin.v7.ui.Grid;
+import com.vaadin.v7.ui.Grid.HeaderRow;
+import com.vaadin.v7.ui.TextField;
+
+@Theme("valo")
+public class GridApplyFilterWhenScrolledDown extends UI {
+
+ private Grid grid = new Grid();
+
+ @Override
+ protected void init(VaadinRequest vaadinRequest) {
+
+ grid.addColumn("Name", String.class);
+
+ HeaderRow appendHeaderRow = grid.appendHeaderRow();
+ TextField filter = getColumnFilter("Name");
+ appendHeaderRow.getCell("Name").setComponent(filter);
+
+ for (int i = 0; i < 1000; i++) {
+ Item addItem = grid.getContainerDataSource().addItem(i);
+ addItem.getItemProperty("Name").setValue("Name " + i);
+
+ }
+
+ Item addItem = grid.getContainerDataSource().addItem(1000);
+ addItem.getItemProperty("Name").setValue("Test");
+
+ // grid.scrollToStart();
+ setContent(grid);
+ }
+
+ private TextField getColumnFilter(final Object columnId) {
+ TextField filter = new TextField();
+ filter.setWidth("100%");
+ filter.addStyleName(ValoTheme.TEXTFIELD_TINY);
+ filter.addTextChangeListener(new TextChangeListener() {
+ SimpleStringFilter filter = null;
+
+ @Override
+ public void textChange(TextChangeEvent event) {
+ Filterable f = (Filterable) grid.getContainerDataSource();
+ if (filter != null) {
+ f.removeContainerFilter(filter);
+ }
+ filter = new SimpleStringFilter(columnId, event.getText(), true,
+ true);
+ f.addContainerFilter(filter);
+ }
+ });
+ return filter;
+ }
+
+} \ No newline at end of file
diff --git a/uitest/src/main/java/com/vaadin/v7/tests/components/grid/InitiallyDisabledGrid.java b/uitest/src/main/java/com/vaadin/v7/tests/components/grid/InitiallyDisabledGrid.java
new file mode 100644
index 0000000000..53e585120e
--- /dev/null
+++ b/uitest/src/main/java/com/vaadin/v7/tests/components/grid/InitiallyDisabledGrid.java
@@ -0,0 +1,60 @@
+package com.vaadin.v7.tests.components.grid;
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+import com.vaadin.server.VaadinRequest;
+import com.vaadin.tests.data.bean.Person;
+import com.vaadin.ui.Button;
+import com.vaadin.ui.UI;
+import com.vaadin.ui.VerticalLayout;
+import com.vaadin.v7.data.util.BeanItemContainer;
+import com.vaadin.v7.ui.Grid;
+
+public class InitiallyDisabledGrid extends UI {
+
+ @Override
+ protected void init(VaadinRequest request) {
+ VerticalLayout layout = new VerticalLayout();
+ setContent(layout);
+ layout.setSizeFull();
+ layout.setWidth("600px");
+ layout.setHeight("600px");
+ final Grid grid = createGrid();
+ Button button = new Button("Enable/Disable",
+ event -> grid.setEnabled(!grid.isEnabled()));
+
+ layout.addComponent(button);
+ VerticalLayout l = new VerticalLayout();
+ l.setSizeFull();
+ l.addComponent(grid);
+
+ layout.addComponent(l);
+ layout.setExpandRatio(l, 1.0f);
+ }
+
+ private Grid createGrid() {
+ // Have some data
+ Collection<Person> people = new ArrayList<>();
+ for (int i = 0; i < 100; i++) {
+ Person person = new Person();
+ person.setFirstName("First " + i);
+ person.setLastName("Last " + i);
+ people.add(person);
+ }
+ // Have a container of some type to contain the data
+ BeanItemContainer<Person> container = new BeanItemContainer<>(
+ Person.class, people);
+
+ // Create a grid bound to the container
+ Grid grid = new Grid(container);
+ grid.setSizeFull();
+ grid.setColumns("firstName", "lastName");
+
+ grid.setEnabled(false);
+
+ return grid;
+
+ }
+
+} \ No newline at end of file
diff --git a/uitest/src/main/java/com/vaadin/v7/tests/components/grid/basicfeatures/GridBasicFeatures.java b/uitest/src/main/java/com/vaadin/v7/tests/components/grid/basicfeatures/GridBasicFeatures.java
index a534074da0..6349405f9b 100644
--- a/uitest/src/main/java/com/vaadin/v7/tests/components/grid/basicfeatures/GridBasicFeatures.java
+++ b/uitest/src/main/java/com/vaadin/v7/tests/components/grid/basicfeatures/GridBasicFeatures.java
@@ -1233,6 +1233,15 @@ public class GridBasicFeatures extends AbstractComponentTest<Grid> {
}
});
+ createBooleanAction("Toggle all column hidden state", "Columns", false,
+ new Command<Grid, Boolean>() {
+ @Override
+ public void execute(Grid c, Boolean value, Object data) {
+ for (Column col : grid.getColumns()) {
+ col.setHidden(!col.isHidden());
+ }
+ }
+ });
createBooleanAction("All columns resizable", "Columns", false,
new Command<Grid, Boolean>() {
diff --git a/uitest/src/main/java/com/vaadin/v7/tests/core/SpecialCharactersEncodingUI.java b/uitest/src/main/java/com/vaadin/v7/tests/core/SpecialCharactersEncodingUI.java
new file mode 100644
index 0000000000..17aa7185fb
--- /dev/null
+++ b/uitest/src/main/java/com/vaadin/v7/tests/core/SpecialCharactersEncodingUI.java
@@ -0,0 +1,30 @@
+package com.vaadin.v7.tests.core;
+
+import com.vaadin.server.VaadinRequest;
+import com.vaadin.tests.components.AbstractTestUI;
+import com.vaadin.ui.Label;
+import com.vaadin.ui.MenuBar;
+import com.vaadin.ui.TextField;
+
+public class SpecialCharactersEncodingUI extends AbstractTestUI {
+
+ public static String textWithZwnj = "\ufeffछुट्‌याउनेछन् क्ष क्‌ष क्‍ष";
+
+ @Override
+ protected void setup(VaadinRequest request) {
+ MenuBar menubar = new MenuBar();
+ menubar.setId("menubar");
+ addComponent(menubar);
+ menubar.addItem(textWithZwnj, null);
+
+ Label label = new Label(textWithZwnj);
+ label.setId("label");
+ addComponent(label);
+
+ TextField f = new TextField("Textfield", textWithZwnj);
+ f.setId("textfield");
+ addComponent(f);
+
+ }
+
+} \ No newline at end of file
diff --git a/uitest/src/main/resources/com/vaadin/tests/components/javascriptcomponent/JSComponent.js b/uitest/src/main/resources/com/vaadin/tests/components/javascriptcomponent/JSComponent.js
new file mode 100644
index 0000000000..522654a930
--- /dev/null
+++ b/uitest/src/main/resources/com/vaadin/tests/components/javascriptcomponent/JSComponent.js
@@ -0,0 +1,11 @@
+com_vaadin_tests_components_javascriptcomponent_JSComponentLoadingIndicator_JSComponent = function()
+{
+ var connector = this;
+ var e = this.getElement();
+
+ e.innerText="click me to ping server";
+ e.id="js";
+ e.addEventListener("click", function() {
+ connector.test();
+ });
+} \ No newline at end of file
diff --git a/uitest/src/test/java/com/vaadin/tests/components/grid/GridApplyFilterWhenScrolledDownTest.java b/uitest/src/test/java/com/vaadin/tests/components/grid/GridApplyFilterWhenScrolledDownTest.java
new file mode 100644
index 0000000000..8e18aeedd1
--- /dev/null
+++ b/uitest/src/test/java/com/vaadin/tests/components/grid/GridApplyFilterWhenScrolledDownTest.java
@@ -0,0 +1,44 @@
+package com.vaadin.tests.components.grid;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.openqa.selenium.WebDriver;
+import org.openqa.selenium.WebElement;
+import org.openqa.selenium.support.ui.ExpectedCondition;
+
+import com.vaadin.testbench.By;
+import com.vaadin.testbench.TestBenchElement;
+import com.vaadin.testbench.elements.ButtonElement;
+import com.vaadin.testbench.elements.GridElement;
+import com.vaadin.tests.tb3.MultiBrowserTest;
+
+public class GridApplyFilterWhenScrolledDownTest extends MultiBrowserTest {
+
+ @Test
+ public void scrolledCorrectly() throws InterruptedException {
+ openTestURL();
+ final GridElement grid = $(GridElement.class).first();
+ grid.scrollToRow(50);
+ $(ButtonElement.class).first().click();
+ final TestBenchElement gridBody = grid.getBody();
+ // Can't use element API because it scrolls
+ waitUntil(new ExpectedCondition<Boolean>() {
+
+ @Override
+ public Boolean apply(WebDriver input) {
+ return gridBody.findElements(By.className("v-grid-row"))
+ .size() == 1;
+ }
+ });
+ WebElement cell = gridBody.findElements(By.className("v-grid-cell"))
+ .get(0);
+ Assert.assertEquals("Test", cell.getText());
+
+ int gridHeight = grid.getSize().getHeight();
+ int scrollerHeight = grid.getVerticalScroller().getSize().getHeight();
+ Assert.assertTrue(
+ "Scroller height is " + scrollerHeight
+ + ", should be smaller than grid height: " + gridHeight,
+ scrollerHeight < gridHeight);
+ }
+} \ No newline at end of file
diff --git a/uitest/src/test/java/com/vaadin/tests/components/grid/GridColumnHidingTest.java b/uitest/src/test/java/com/vaadin/tests/components/grid/GridColumnHidingTest.java
index e0ec3edbd8..dca31e5249 100644
--- a/uitest/src/test/java/com/vaadin/tests/components/grid/GridColumnHidingTest.java
+++ b/uitest/src/test/java/com/vaadin/tests/components/grid/GridColumnHidingTest.java
@@ -15,15 +15,20 @@
*/
package com.vaadin.tests.components.grid;
+import static org.junit.Assert.assertEquals;
+
import java.util.List;
import org.junit.Assert;
import org.junit.Test;
+import org.openqa.selenium.Dimension;
import org.openqa.selenium.WebElement;
+import org.openqa.selenium.interactions.Actions;
import com.vaadin.testbench.By;
import com.vaadin.testbench.customelements.GridElement;
import com.vaadin.testbench.elements.ButtonElement;
+import com.vaadin.testbench.elements.GridElement.GridCellElement;
import com.vaadin.testbench.elements.LabelElement;
import com.vaadin.tests.tb3.MultiBrowserTest;
@@ -119,6 +124,30 @@ public class GridColumnHidingTest extends MultiBrowserTest {
"custom age column caption".equals(elements.get(1).getText()));
}
+ @Test
+ public void testShrinkColumnToZeroWithHiddenColumn() {
+ openTestURL();
+
+ // hide all
+ $(ButtonElement.class).get(3).click();
+
+ ButtonElement toggleNameColumn = $(ButtonElement.class).get(0);
+ ButtonElement toggleEmailColumn = $(ButtonElement.class).get(2);
+
+ // Show
+ toggleNameColumn.click();
+ toggleEmailColumn.click();
+
+ GridElement gridElement = $(GridElement.class).first();
+
+ GridCellElement cell = gridElement.getCell(0, 1);
+ dragResizeColumn(1, 0, -cell.getSize().getWidth());
+ assertGreaterOrEqual("Cell got too small.", cell.getSize().getWidth(),
+ 10);
+ assertEquals(gridElement.getCell(0, 0).getLocation().getY(),
+ gridElement.getCell(0, 1).getLocation().getY());
+ }
+
protected WebElement getSidebarOpenButton(GridElement grid) {
List<WebElement> elements = grid
.findElements(By.className("v-grid-sidebar-button"));
@@ -146,4 +175,15 @@ public class GridColumnHidingTest extends MultiBrowserTest {
By.className("v-grid-sidebar-popup"));
return elements.isEmpty() ? null : elements.get(0);
}
+
+ private void dragResizeColumn(int columnIndex, int posX, int offset) {
+ GridElement gridElement = $(GridElement.class).first();
+
+ GridCellElement headerCell = gridElement.getHeaderCell(0, columnIndex);
+ Dimension size = headerCell.getSize();
+ new Actions(getDriver())
+ .moveToElement(headerCell, size.getWidth() + posX,
+ size.getHeight() / 2)
+ .clickAndHold().moveByOffset(offset, 0).release().perform();
+ }
}
diff --git a/uitest/src/test/java/com/vaadin/tests/components/grid/InitiallyDisabledGridTest.java b/uitest/src/test/java/com/vaadin/tests/components/grid/InitiallyDisabledGridTest.java
new file mode 100644
index 0000000000..e57b8d3efe
--- /dev/null
+++ b/uitest/src/test/java/com/vaadin/tests/components/grid/InitiallyDisabledGridTest.java
@@ -0,0 +1,45 @@
+package com.vaadin.tests.components.grid;
+
+import java.util.List;
+
+import org.junit.Assert;
+import org.junit.Ignore;
+import org.junit.Test;
+import org.openqa.selenium.WebElement;
+
+import com.vaadin.testbench.By;
+import com.vaadin.testbench.customelements.GridElement;
+import com.vaadin.testbench.elements.ButtonElement;
+import com.vaadin.testbench.elements.GridElement.GridCellElement;
+import com.vaadin.tests.tb3.SingleBrowserTest;
+
+public class InitiallyDisabledGridTest extends SingleBrowserTest {
+
+ @Test
+ public void columnsExpanded() {
+ openTestURL();
+
+ List<WebElement> cells = findElements(By.className("v-grid-cell"));
+ WebElement col0 = cells.get(0);
+ WebElement col1 = cells.get(1);
+ Assert.assertTrue(col0.getSize().getWidth() > 250);
+ Assert.assertTrue(col1.getSize().getWidth() > 250);
+ }
+
+ @Test
+ @Ignore
+ /*
+ * The test fails at the moment because of issues related (or exactly the
+ * same) as https://github.com/vaadin/framework8-issues/issues/286. It
+ * should be enabled once it's fixed.
+ */
+ public void worksWhenEnabled() {
+ openTestURL();
+ $(ButtonElement.class).first().click();
+
+ GridElement grid = $(GridElement.class).first();
+ grid.scrollToRow(80);
+ GridCellElement col0 = grid.getCell(80, 0);
+ Assert.assertEquals("First 80", col0.getText());
+ }
+} \ No newline at end of file
diff --git a/uitest/src/test/java/com/vaadin/tests/components/javascriptcomponent/JSComponentLoadingIndicatorTest.java b/uitest/src/test/java/com/vaadin/tests/components/javascriptcomponent/JSComponentLoadingIndicatorTest.java
new file mode 100644
index 0000000000..4532b22937
--- /dev/null
+++ b/uitest/src/test/java/com/vaadin/tests/components/javascriptcomponent/JSComponentLoadingIndicatorTest.java
@@ -0,0 +1,29 @@
+package com.vaadin.tests.components.javascriptcomponent;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.openqa.selenium.WebElement;
+
+import com.vaadin.testbench.By;
+import com.vaadin.tests.tb3.SingleBrowserTest;
+
+public class JSComponentLoadingIndicatorTest extends SingleBrowserTest {
+
+ @Test
+ public void ensureLoadingIndicatorShown() {
+ openTestURL();
+ testBench().disableWaitForVaadin();
+
+ WebElement js = findElement(By.id("js"));
+ js.click();
+ waitUntilLoadingIndicatorVisible();
+ waitUntilLoadingIndicatorNotVisible();
+ Assert.assertEquals(1, findElements(By.className("pong")).size());
+
+ js.click();
+ waitUntilLoadingIndicatorVisible();
+ waitUntilLoadingIndicatorNotVisible();
+ Assert.assertEquals(2, findElements(By.className("pong")).size());
+ }
+
+} \ No newline at end of file
diff --git a/uitest/src/test/java/com/vaadin/tests/components/tabsheet/TabsheetScrollIntoViewTest.java b/uitest/src/test/java/com/vaadin/tests/components/tabsheet/TabsheetScrollIntoViewTest.java
index 57e2714105..074d952889 100644
--- a/uitest/src/test/java/com/vaadin/tests/components/tabsheet/TabsheetScrollIntoViewTest.java
+++ b/uitest/src/test/java/com/vaadin/tests/components/tabsheet/TabsheetScrollIntoViewTest.java
@@ -21,13 +21,24 @@ import org.junit.Assert;
import org.junit.Test;
import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
+import org.openqa.selenium.remote.DesiredCapabilities;
import com.vaadin.testbench.elements.ButtonElement;
import com.vaadin.testbench.elements.TabSheetElement;
+import com.vaadin.testbench.parallel.Browser;
import com.vaadin.tests.tb3.MultiBrowserTest;
public class TabsheetScrollIntoViewTest extends MultiBrowserTest {
+ @Override
+ public List<DesiredCapabilities> getBrowsersToTest() {
+ List<DesiredCapabilities> browsers = super.getBrowsersToTest();
+ // For whatever reason, IE8 never returns from the
+ // $(TabSheetElement.class).first() call
+ browsers.remove(Browser.IE8.getDesiredCapabilities());
+ return browsers;
+ }
+
@Test
public void scrollIntoView() {
openTestURL();
diff --git a/uitest/src/test/java/com/vaadin/tests/core/SpecialCharactersEncodingUITest.java b/uitest/src/test/java/com/vaadin/tests/core/SpecialCharactersEncodingUITest.java
new file mode 100644
index 0000000000..03a441623b
--- /dev/null
+++ b/uitest/src/test/java/com/vaadin/tests/core/SpecialCharactersEncodingUITest.java
@@ -0,0 +1,37 @@
+package com.vaadin.tests.core;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.openqa.selenium.WebElement;
+
+import com.vaadin.testbench.By;
+import com.vaadin.testbench.elements.LabelElement;
+import com.vaadin.testbench.elements.MenuBarElement;
+import com.vaadin.testbench.elements.TextFieldElement;
+import com.vaadin.tests.tb3.SingleBrowserTest;
+
+public class SpecialCharactersEncodingUITest extends SingleBrowserTest {
+
+ @Test
+ public void checkEncoding() {
+ openTestURL();
+ String textFieldValue = $(TextFieldElement.class).id("textfield")
+ .getValue();
+ Assert.assertEquals(SpecialCharactersEncodingUI.textWithZwnj,
+ textFieldValue);
+ LabelElement label = $(LabelElement.class).id("label");
+ String labelValue = getHtml(label); // getText() strips some characters
+ Assert.assertEquals(SpecialCharactersEncodingUI.textWithZwnj,
+ labelValue);
+
+ MenuBarElement menubar = $(MenuBarElement.class).first();
+ WebElement menuItem = menubar
+ .findElement(By.className("v-menubar-menuitem-caption"));
+ Assert.assertEquals(SpecialCharactersEncodingUI.textWithZwnj,
+ getHtml(menuItem));
+ }
+
+ private String getHtml(WebElement element) {
+ return element.getAttribute("innerHTML");
+ }
+} \ No newline at end of file
diff --git a/uitest/src/test/java/com/vaadin/v7/tests/components/datefield/DateFieldDiscardValueTest.java b/uitest/src/test/java/com/vaadin/v7/tests/components/datefield/DateFieldDiscardValueTest.java
new file mode 100644
index 0000000000..e215370560
--- /dev/null
+++ b/uitest/src/test/java/com/vaadin/v7/tests/components/datefield/DateFieldDiscardValueTest.java
@@ -0,0 +1,85 @@
+package com.vaadin.v7.tests.components.datefield;
+
+import static org.junit.Assert.assertEquals;
+
+import java.util.List;
+
+import org.junit.Test;
+import org.openqa.selenium.By;
+import org.openqa.selenium.WebElement;
+
+import com.vaadin.testbench.elements.ButtonElement;
+import com.vaadin.testbench.elements.DateFieldElement;
+import com.vaadin.tests.tb3.SingleBrowserTest;
+
+public class DateFieldDiscardValueTest extends SingleBrowserTest {
+
+ @Test
+ public void discardWhenDatasourceContentNonNullInvalidValue() {
+ discardWorks(DateFieldDiscardValue.PROP_NONULL, "1", "123", "25/07/16");
+ }
+
+ @Test
+ public void discardWhenDatasourceContentNonNullValidValue() {
+ discardWorks(DateFieldDiscardValue.PROP_NONULL, "1", "24/07/16",
+ "25/07/16");
+ }
+
+ @Test
+ public void discardWhenDatasourceContentNullInvalidValue() {
+ discardWorks(DateFieldDiscardValue.PROP_NULL_VALUE, "2", "123", "");
+ }
+
+ @Test
+ public void discardWhenDatasourceContentNullValidValue() {
+ discardWorks(DateFieldDiscardValue.PROP_NULL_VALUE, "2", "24/07/16",
+ "");
+ }
+
+ @Test
+ public void discardWhenDatasourceNull() {
+ // If the data source is null, discard should do nothing.
+ discardDoesntWork(DateFieldDiscardValue.PROP_NULL, "3", "123");
+ }
+
+ private void discardWorks(String caption, String id, String dateValue,
+ String resultValue) {
+ openTestURL();
+
+ ButtonElement discardButton = $(ButtonElement.class)
+ .caption("Discard " + id).first();
+ DateFieldElement dateField = $(DateFieldElement.class).caption(caption)
+ .first();
+ dateField.setValue(dateValue);
+
+ discardButton.click();
+
+ assertEquals(resultValue, dateField.getValue());
+
+ List<WebElement> elements = driver
+ .findElements(By.className("v-errorindicator"));
+
+ assertEquals(0, elements.size());
+ }
+
+ private void discardDoesntWork(String caption, String id,
+ String dateValue) {
+ openTestURL();
+
+ ButtonElement discardButton = $(ButtonElement.class)
+ .caption("Discard " + id).first();
+ DateFieldElement dateField = $(DateFieldElement.class).caption(caption)
+ .first();
+ dateField.setValue(dateValue);
+
+ discardButton.click();
+
+ assertEquals(dateValue, dateField.getValue());
+
+ List<WebElement> elements = driver
+ .findElements(By.className("v-errorindicator"));
+
+ assertEquals(1, elements.size());
+ }
+
+} \ No newline at end of file
diff --git a/uitest/src/test/java/com/vaadin/v7/tests/components/grid/GridApplyFilterWhenScrolledDownTest.java b/uitest/src/test/java/com/vaadin/v7/tests/components/grid/GridApplyFilterWhenScrolledDownTest.java
new file mode 100644
index 0000000000..9a14c01146
--- /dev/null
+++ b/uitest/src/test/java/com/vaadin/v7/tests/components/grid/GridApplyFilterWhenScrolledDownTest.java
@@ -0,0 +1,44 @@
+package com.vaadin.v7.tests.components.grid;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.openqa.selenium.WebDriver;
+import org.openqa.selenium.WebElement;
+import org.openqa.selenium.support.ui.ExpectedCondition;
+
+import com.vaadin.testbench.By;
+import com.vaadin.testbench.TestBenchElement;
+import com.vaadin.testbench.elements.GridElement;
+import com.vaadin.testbench.elements.TextFieldElement;
+import com.vaadin.tests.tb3.MultiBrowserTest;
+
+public class GridApplyFilterWhenScrolledDownTest extends MultiBrowserTest {
+
+ @Test
+ public void scrolledCorrectly() throws InterruptedException {
+ openTestURL();
+ final GridElement grid = $(GridElement.class).first();
+ grid.scrollToRow(50);
+ $(TextFieldElement.class).first().setValue("Test");
+ final TestBenchElement gridBody = grid.getBody();
+ // Can't use element API because it scrolls
+ waitUntil(new ExpectedCondition<Boolean>() {
+
+ @Override
+ public Boolean apply(WebDriver input) {
+ return gridBody.findElements(By.className("v-grid-row"))
+ .size() == 1;
+ }
+ });
+ WebElement cell = gridBody.findElements(By.className("v-grid-cell"))
+ .get(0);
+ Assert.assertEquals("Test", cell.getText());
+
+ int gridHeight = grid.getSize().getHeight();
+ int scrollerHeight = grid.getVerticalScroller().getSize().getHeight();
+ Assert.assertTrue(
+ "Scroller height is " + scrollerHeight
+ + ", should be smaller than grid height: " + gridHeight,
+ scrollerHeight < gridHeight);
+ }
+} \ No newline at end of file
diff --git a/uitest/src/test/java/com/vaadin/v7/tests/components/grid/InitiallyDisabledGridTest.java b/uitest/src/test/java/com/vaadin/v7/tests/components/grid/InitiallyDisabledGridTest.java
new file mode 100644
index 0000000000..8f012eed25
--- /dev/null
+++ b/uitest/src/test/java/com/vaadin/v7/tests/components/grid/InitiallyDisabledGridTest.java
@@ -0,0 +1,34 @@
+package com.vaadin.v7.tests.components.grid;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+import com.vaadin.testbench.elements.ButtonElement;
+import com.vaadin.testbench.elements.GridElement;
+import com.vaadin.testbench.elements.GridElement.GridCellElement;
+import com.vaadin.tests.tb3.SingleBrowserTest;
+
+public class InitiallyDisabledGridTest extends SingleBrowserTest {
+
+ @Test
+ public void columnsExpanded() {
+ openTestURL();
+
+ GridElement grid = $(GridElement.class).first();
+ GridCellElement col0 = grid.getCell(0, 0);
+ GridCellElement col1 = grid.getCell(0, 1);
+ Assert.assertTrue(col0.getSize().getWidth() > 250);
+ Assert.assertTrue(col1.getSize().getWidth() > 250);
+ }
+
+ @Test
+ public void worksWhenEnabled() {
+ openTestURL();
+ $(ButtonElement.class).first().click();
+
+ GridElement grid = $(GridElement.class).first();
+ grid.scrollToRow(80);
+ GridCellElement col0 = grid.getCell(80, 0);
+ Assert.assertEquals("First 80", col0.getText());
+ }
+} \ No newline at end of file
diff --git a/uitest/src/test/java/com/vaadin/v7/tests/components/grid/basicfeatures/server/GridColumnResizeTest.java b/uitest/src/test/java/com/vaadin/v7/tests/components/grid/basicfeatures/server/GridColumnResizeTest.java
index 22bea4f9f5..fda42e7739 100644
--- a/uitest/src/test/java/com/vaadin/v7/tests/components/grid/basicfeatures/server/GridColumnResizeTest.java
+++ b/uitest/src/test/java/com/vaadin/v7/tests/components/grid/basicfeatures/server/GridColumnResizeTest.java
@@ -146,4 +146,25 @@ public class GridColumnResizeTest extends GridBasicFeaturesTest {
assertGreaterOrEqual("Cell got too small.", cell.getSize().getWidth(),
10);
}
+
+ @Test
+ public void testShrinkColumnToZeroWithHiddenColumn() {
+ openTestURL();
+ selectMenuPath("Component", "Columns",
+ "Toggle all column hidden state");
+ // Hides although already hidden
+ selectMenuPath("Component", "Columns", "Column 0", "Hidden");
+ // Shows
+ selectMenuPath("Component", "Columns", "Column 0", "Hidden");
+ // Hides although already hidden
+ selectMenuPath("Component", "Columns", "Column 2", "Hidden");
+ // Shows
+ selectMenuPath("Component", "Columns", "Column 2", "Hidden");
+ GridCellElement cell = getGridElement().getCell(0, 1);
+ dragResizeColumn(1, 0, -cell.getSize().getWidth());
+ assertGreaterOrEqual("Cell got too small.", cell.getSize().getWidth(),
+ 10);
+ assertEquals(getGridElement().getCell(0, 0).getLocation().getY(),
+ getGridElement().getCell(0, 1).getLocation().getY());
+ }
}
diff --git a/uitest/src/test/java/com/vaadin/v7/tests/components/grid/basicfeatures/server/GridColumnVisibilityTest.java b/uitest/src/test/java/com/vaadin/v7/tests/components/grid/basicfeatures/server/GridColumnVisibilityTest.java
index 65fe0e7dee..b63da5ce30 100644
--- a/uitest/src/test/java/com/vaadin/v7/tests/components/grid/basicfeatures/server/GridColumnVisibilityTest.java
+++ b/uitest/src/test/java/com/vaadin/v7/tests/components/grid/basicfeatures/server/GridColumnVisibilityTest.java
@@ -21,9 +21,11 @@ import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
+import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
+import com.vaadin.testbench.elements.GridElement;
import com.vaadin.testbench.parallel.TestCategory;
import com.vaadin.v7.tests.components.grid.basicfeatures.GridBasicFeaturesTest;
@@ -295,6 +297,35 @@ public class GridColumnVisibilityTest extends GridBasicFeaturesTest {
verifyColumnNotFrozen(2);
}
+ @Test
+ public void showColumnAndScrollbarWhenScrolledDownAndVisibleRowsChange()
+ throws Exception {
+ // Set a (un)suitable height
+ selectMenuPath("Component", "Size", "HeightMode Row");
+ selectMenuPath("Component", "Size", "Height by Rows", "4.33 rows");
+
+ toggleAllColumnsHidable();
+
+ // Hide all but the first 3
+ getSidebarOpenButton().click();
+ for (int i = 3; i < 12; i++) {
+ getColumnHidingToggle(i).click();
+ }
+
+ getSidebarOpenButton().click();
+
+ // Scroll all the way to the end
+ $(GridElement.class).first().scrollToRow(999);
+
+ // Show the fourth column
+ getSidebarOpenButton().click();
+ getColumnHidingToggle(3).click();
+
+ // Make sure that the new column contains the data it should
+ Assert.assertEquals("(999, 3)",
+ getGridElement().getCell(999, 3).getText());
+ }
+
private void verifyColumnFrozen(int index) {
assertTrue(getGridElement().getHeaderCell(0, index).isFrozen());
}
@@ -307,6 +338,10 @@ public class GridColumnVisibilityTest extends GridBasicFeaturesTest {
selectMenuPath("Component", "Columns", "Column " + index, "Hidable");
}
+ private void toggleAllColumnsHidable() {
+ selectMenuPath("Component", "Columns", "All columns hidable");
+ }
+
private void addRemoveColumn(int index) {
selectMenuPath("Component", "Columns", "Column " + index,
"Add / Remove");
diff --git a/uitest/src/test/java/com/vaadin/v7/tests/core/SpecialCharactersEncodingUITest.java b/uitest/src/test/java/com/vaadin/v7/tests/core/SpecialCharactersEncodingUITest.java
new file mode 100644
index 0000000000..02cad362eb
--- /dev/null
+++ b/uitest/src/test/java/com/vaadin/v7/tests/core/SpecialCharactersEncodingUITest.java
@@ -0,0 +1,37 @@
+package com.vaadin.v7.tests.core;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.openqa.selenium.WebElement;
+
+import com.vaadin.testbench.By;
+import com.vaadin.testbench.elements.LabelElement;
+import com.vaadin.testbench.elements.MenuBarElement;
+import com.vaadin.testbench.elements.TextFieldElement;
+import com.vaadin.tests.tb3.SingleBrowserTest;
+
+public class SpecialCharactersEncodingUITest extends SingleBrowserTest {
+
+ @Test
+ public void checkEncoding() {
+ openTestURL();
+ String textFieldValue = $(TextFieldElement.class).id("textfield")
+ .getValue();
+ Assert.assertEquals(SpecialCharactersEncodingUI.textWithZwnj,
+ textFieldValue);
+ LabelElement label = $(LabelElement.class).id("label");
+ String labelValue = getHtml(label); // getText() strips some characters
+ Assert.assertEquals(SpecialCharactersEncodingUI.textWithZwnj,
+ labelValue);
+
+ MenuBarElement menubar = $(MenuBarElement.class).first();
+ WebElement menuItem = menubar
+ .findElement(By.className("v-menubar-menuitem-caption"));
+ Assert.assertEquals(SpecialCharactersEncodingUI.textWithZwnj,
+ getHtml(menuItem));
+ }
+
+ private String getHtml(WebElement element) {
+ return element.getAttribute("innerHTML");
+ }
+} \ No newline at end of file