diff options
author | Teemu Suo-Anttila <teemusa@vaadin.com> | 2016-09-06 15:34:12 +0300 |
---|---|---|
committer | Vaadin Code Review <review@vaadin.com> | 2016-09-07 05:54:52 +0000 |
commit | 400818bff226f60e37ee30ed3a0ffe7e845dcf67 (patch) | |
tree | 4425e49236446dae613ad0c12dbf3e0a5c4af050 /uitest | |
parent | 3d3f12d92bb840a66ed6caaf992e0fe7bb3c1e77 (diff) | |
download | vaadin-framework-400818bff226f60e37ee30ed3a0ffe7e845dcf67.tar.gz vaadin-framework-400818bff226f60e37ee30ed3a0ffe7e845dcf67.zip |
Fix empty data source client-side events
Change-Id: I7e84fd01cf2ec46b18af960712226a48f600f623
Diffstat (limited to 'uitest')
-rw-r--r-- | uitest/src/main/java/com/vaadin/tests/data/DummyData.java | 3 | ||||
-rw-r--r-- | uitest/src/test/java/com/vaadin/tests/data/DummyDataTest.java | 24 |
2 files changed, 27 insertions, 0 deletions
diff --git a/uitest/src/main/java/com/vaadin/tests/data/DummyData.java b/uitest/src/main/java/com/vaadin/tests/data/DummyData.java index 60b3af7681..8b4083d834 100644 --- a/uitest/src/main/java/com/vaadin/tests/data/DummyData.java +++ b/uitest/src/main/java/com/vaadin/tests/data/DummyData.java @@ -112,6 +112,9 @@ public class DummyData extends AbstractTestUIWithLog { controls.addComponent(new Button("Reset data source", e -> { dummy.setDataSource(new LoggingDataSource(items)); })); + controls.addComponent(new Button("Remove all data", e -> { + dummy.setDataSource(new LoggingDataSource(Collections.emptyList())); + })); addComponent(dummy); } } diff --git a/uitest/src/test/java/com/vaadin/tests/data/DummyDataTest.java b/uitest/src/test/java/com/vaadin/tests/data/DummyDataTest.java index 48001ef27f..1e9f0f9ade 100644 --- a/uitest/src/test/java/com/vaadin/tests/data/DummyDataTest.java +++ b/uitest/src/test/java/com/vaadin/tests/data/DummyDataTest.java @@ -10,11 +10,17 @@ import org.junit.Test; import org.openqa.selenium.WebElement; import com.vaadin.testbench.By; +import com.vaadin.testbench.elements.AbstractComponentElement; import com.vaadin.testbench.elements.ButtonElement; +import com.vaadin.testbench.elementsbase.ServerClass; import com.vaadin.tests.tb3.SingleBrowserTest; public class DummyDataTest extends SingleBrowserTest { + @ServerClass("com.vaadin.tests.data.DummyData.DummyComponent") + public static class DummyElement extends AbstractComponentElement { + } + @Before public void setUp() { setDebug(true); @@ -57,4 +63,22 @@ public class DummyDataTest extends SingleBrowserTest { assertEquals("DataSource change should only cause 1 request", "3. Backend request #0", getLogRow(0)); } + + @Test + public void testEmptyAndRestoreContent() { + assertEquals("Unexpected amount of content on init.", 300, + $(DummyElement.class).first() + .findElements(By.className("v-label")).size()); + // Change to an empty data source + $(ButtonElement.class).get(2).click(); + assertEquals("Empty data source did not work as expected.", 0, + $(DummyElement.class).first() + .findElements(By.className("v-label")).size()); + // Change back to logging data source + $(ButtonElement.class).get(1).click(); + assertEquals("Data was not correctly restored.", 300, + $(DummyElement.class).first() + .findElements(By.className("v-label")).size()); + } + } |