diff options
author | Denis <denis@vaadin.com> | 2017-01-02 13:04:26 +0200 |
---|---|---|
committer | Pekka Hyvönen <pekka@vaadin.com> | 2017-01-02 13:04:26 +0200 |
commit | 6adc887b7f94f5fb6e83c34822358e2240018147 (patch) | |
tree | d932f91bb8d57fbab784cb3300ddb9bf849d4744 /uitest | |
parent | 0740ac116e637d81bd7e2415746f020dd25102e6 (diff) | |
download | vaadin-framework-6adc887b7f94f5fb6e83c34822358e2240018147.tar.gz vaadin-framework-6adc887b7f94f5fb6e83c34822358e2240018147.zip |
Migrate Grid tests P1. (#8108)
* Migrate Grid tests P1.
Fixes vaadin/framework8-issues#586
Diffstat (limited to 'uitest')
17 files changed, 189 insertions, 353 deletions
diff --git a/uitest/src/main/java/com/vaadin/v7/tests/components/grid/BeanRenderer.java b/uitest/src/main/java/com/vaadin/tests/components/grid/BeanRenderer.java index c3036e93b4..09d793588e 100644 --- a/uitest/src/main/java/com/vaadin/v7/tests/components/grid/BeanRenderer.java +++ b/uitest/src/main/java/com/vaadin/tests/components/grid/BeanRenderer.java @@ -13,12 +13,13 @@ * License for the specific language governing permissions and limitations under * the License. */ -package com.vaadin.v7.tests.components.grid; +package com.vaadin.tests.components.grid; +import com.vaadin.tests.components.grid.CustomRendererUI.Data; import com.vaadin.tests.widgetset.client.SimpleTestBean; -import com.vaadin.v7.ui.Grid.AbstractRenderer; +import com.vaadin.ui.renderers.AbstractRenderer; -public class BeanRenderer extends AbstractRenderer<SimpleTestBean> { +public class BeanRenderer extends AbstractRenderer<Data, SimpleTestBean> { public BeanRenderer() { super(SimpleTestBean.class, ""); } diff --git a/uitest/src/main/java/com/vaadin/tests/components/grid/CustomRendererUI.java b/uitest/src/main/java/com/vaadin/tests/components/grid/CustomRendererUI.java new file mode 100644 index 0000000000..980a635cd4 --- /dev/null +++ b/uitest/src/main/java/com/vaadin/tests/components/grid/CustomRendererUI.java @@ -0,0 +1,111 @@ +/* + * Copyright 2000-2016 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.tests.components.grid; + +import com.vaadin.annotations.Widgetset; +import com.vaadin.server.VaadinRequest; +import com.vaadin.tests.components.AbstractTestUI; +import com.vaadin.tests.widgetset.TestingWidgetSet; +import com.vaadin.tests.widgetset.client.EmptyEnum; +import com.vaadin.tests.widgetset.client.SimpleTestBean; +import com.vaadin.ui.Grid; +import com.vaadin.ui.Grid.SelectionMode; +import com.vaadin.ui.Label; + +@Widgetset(TestingWidgetSet.NAME) +public class CustomRendererUI extends AbstractTestUI { + + public static class Data { + private int[] array; + + private EmptyEnum emptyProperty; + + private SimpleTestBean bean; + + private final String id; + + public Data(String id) { + this.id = id; + } + + public int[] getArray() { + return array; + } + + public void setArray(int[] array) { + this.array = array; + } + + public EmptyEnum getEmptyProperty() { + return emptyProperty; + } + + public void setEmptyProperty(EmptyEnum emptyProperty) { + this.emptyProperty = emptyProperty; + } + + public SimpleTestBean getBean() { + return bean; + } + + public void setBean(SimpleTestBean bean) { + this.bean = bean; + } + + @Override + public String toString() { + return id; + } + } + + @Override + protected void setup(VaadinRequest request) { + Data data = new Data("test-data"); + data.setArray(new int[] { 1, 1, 2, 3, 5, 8, 13 }); + + SimpleTestBean bean = new SimpleTestBean(); + bean.setValue(42); + data.setBean(bean); + + Grid<Data> grid = new Grid<>(); + + Label debugLabel = new Label("Debug label placeholder"); + debugLabel.setId("debuglabel"); + grid.addColumn(Data::getArray, new IntArrayRenderer()); + grid.addColumn(Data::getEmptyProperty, + new RowAwareRenderer(debugLabel)); + grid.addColumn(Data::getBean, new BeanRenderer()); + + grid.setSelectionMode(SelectionMode.NONE); + + grid.setItems(data); + + addComponent(grid); + addComponent(debugLabel); + } + + @Override + protected String getTestDescription() { + return "Verifies that renderers operating on other data than " + + "just Strings also work "; + } + + @Override + protected Integer getTicketNumber() { + return 13334; + } + +} diff --git a/uitest/src/main/java/com/vaadin/v7/tests/components/grid/IntArrayRenderer.java b/uitest/src/main/java/com/vaadin/tests/components/grid/IntArrayRenderer.java index a50d7dd251..effdc832ac 100644 --- a/uitest/src/main/java/com/vaadin/v7/tests/components/grid/IntArrayRenderer.java +++ b/uitest/src/main/java/com/vaadin/tests/components/grid/IntArrayRenderer.java @@ -13,11 +13,12 @@ * License for the specific language governing permissions and limitations under * the License. */ -package com.vaadin.v7.tests.components.grid; +package com.vaadin.tests.components.grid; -import com.vaadin.v7.ui.Grid.AbstractRenderer; +import com.vaadin.tests.components.grid.CustomRendererUI.Data; +import com.vaadin.ui.renderers.AbstractRenderer; -public class IntArrayRenderer extends AbstractRenderer<int[]> { +public class IntArrayRenderer extends AbstractRenderer<Data, int[]> { public IntArrayRenderer() { super(int[].class, ""); } diff --git a/uitest/src/main/java/com/vaadin/v7/tests/components/grid/RowAwareRenderer.java b/uitest/src/main/java/com/vaadin/tests/components/grid/RowAwareRenderer.java index 288116b630..49b7808291 100644 --- a/uitest/src/main/java/com/vaadin/v7/tests/components/grid/RowAwareRenderer.java +++ b/uitest/src/main/java/com/vaadin/tests/components/grid/RowAwareRenderer.java @@ -13,20 +13,23 @@ * License for the specific language governing permissions and limitations under * the License. */ -package com.vaadin.v7.tests.components.grid; +package com.vaadin.tests.components.grid; -import com.vaadin.tests.widgetset.client.v7.grid.RowAwareRendererConnector.RowAwareRendererRpc; +import com.vaadin.tests.components.grid.CustomRendererUI.Data; +import com.vaadin.tests.widgetset.client.EmptyEnum; +import com.vaadin.tests.widgetset.client.grid.RowAwareRendererConnector.RowAwareRendererRpc; import com.vaadin.ui.Label; -import com.vaadin.v7.ui.Grid.AbstractRenderer; +import com.vaadin.ui.renderers.AbstractRenderer; -public class RowAwareRenderer extends AbstractRenderer<Void> { +public class RowAwareRenderer extends AbstractRenderer<Data, EmptyEnum> { public RowAwareRenderer(final Label debugLabel) { - super(Void.class, ""); + super(EmptyEnum.class, ""); registerRpc(new RowAwareRendererRpc() { @Override public void clicky(String key) { - Object itemId = getItemId(key); - debugLabel.setValue("key: " + key + ", itemId: " + itemId); + Data data = getParentGrid().getDataCommunicator().getKeyMapper() + .get(key); + debugLabel.setValue("key: " + key + ", itemId: " + data); } }); } diff --git a/uitest/src/main/java/com/vaadin/v7/tests/components/grid/GridAddRow.java b/uitest/src/main/java/com/vaadin/tests/smoke/GridSmoke.java index 3ee500d78a..ebca101d08 100644 --- a/uitest/src/main/java/com/vaadin/v7/tests/components/grid/GridAddRow.java +++ b/uitest/src/main/java/com/vaadin/tests/smoke/GridSmoke.java @@ -13,7 +13,7 @@ * License for the specific language governing permissions and limitations under * the License. */ -package com.vaadin.v7.tests.components.grid; +package com.vaadin.tests.smoke; import com.vaadin.server.VaadinRequest; import com.vaadin.tests.components.AbstractReindeerTestUI; @@ -22,7 +22,7 @@ import com.vaadin.ui.Button.ClickEvent; import com.vaadin.v7.ui.Grid; import com.vaadin.v7.ui.Grid.SelectionMode; -public class GridAddRow extends AbstractReindeerTestUI { +public class GridSmoke extends AbstractReindeerTestUI { @Override protected void setup(VaadinRequest request) { diff --git a/uitest/src/main/java/com/vaadin/tests/widgetset/client/EmptyEnum.java b/uitest/src/main/java/com/vaadin/tests/widgetset/client/EmptyEnum.java new file mode 100644 index 0000000000..6e0b97eea7 --- /dev/null +++ b/uitest/src/main/java/com/vaadin/tests/widgetset/client/EmptyEnum.java @@ -0,0 +1,25 @@ +/* + * Copyright 2000-2016 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.tests.widgetset.client; + +/** + * @author Vaadin Ltd + * + */ +public enum EmptyEnum { + +} + diff --git a/uitest/src/main/java/com/vaadin/tests/widgetset/client/v7/grid/IntArrayRendererConnector.java b/uitest/src/main/java/com/vaadin/tests/widgetset/client/grid/IntArrayRendererConnector.java index 28056c4b47..face2a95e0 100644 --- a/uitest/src/main/java/com/vaadin/tests/widgetset/client/v7/grid/IntArrayRendererConnector.java +++ b/uitest/src/main/java/com/vaadin/tests/widgetset/client/grid/IntArrayRendererConnector.java @@ -13,14 +13,14 @@ * License for the specific language governing permissions and limitations under * the License. */ -package com.vaadin.tests.widgetset.client.v7.grid; +package com.vaadin.tests.widgetset.client.grid; +import com.vaadin.client.connectors.grid.AbstractGridRendererConnector; +import com.vaadin.client.renderers.Renderer; +import com.vaadin.client.widget.grid.RendererCellReference; import com.vaadin.shared.ui.Connect; -import com.vaadin.v7.client.connectors.AbstractGridRendererConnector; -import com.vaadin.v7.client.renderers.Renderer; -import com.vaadin.v7.client.widget.grid.RendererCellReference; -@Connect(com.vaadin.v7.tests.components.grid.IntArrayRenderer.class) +@Connect(com.vaadin.tests.components.grid.IntArrayRenderer.class) public class IntArrayRendererConnector extends AbstractGridRendererConnector<int[]> { diff --git a/uitest/src/main/java/com/vaadin/tests/widgetset/client/v7/grid/PojoRendererConnector.java b/uitest/src/main/java/com/vaadin/tests/widgetset/client/grid/PojoRendererConnector.java index fdbdd324a7..a74db261eb 100644 --- a/uitest/src/main/java/com/vaadin/tests/widgetset/client/v7/grid/PojoRendererConnector.java +++ b/uitest/src/main/java/com/vaadin/tests/widgetset/client/grid/PojoRendererConnector.java @@ -13,15 +13,15 @@ * License for the specific language governing permissions and limitations under * the License. */ -package com.vaadin.tests.widgetset.client.v7.grid; +package com.vaadin.tests.widgetset.client.grid; +import com.vaadin.client.connectors.grid.AbstractGridRendererConnector; +import com.vaadin.client.renderers.Renderer; +import com.vaadin.client.widget.grid.RendererCellReference; import com.vaadin.shared.ui.Connect; import com.vaadin.tests.widgetset.client.SimpleTestBean; -import com.vaadin.v7.client.connectors.AbstractGridRendererConnector; -import com.vaadin.v7.client.renderers.Renderer; -import com.vaadin.v7.client.widget.grid.RendererCellReference; -@Connect(com.vaadin.v7.tests.components.grid.BeanRenderer.class) +@Connect(com.vaadin.tests.components.grid.BeanRenderer.class) public class PojoRendererConnector extends AbstractGridRendererConnector<SimpleTestBean> { diff --git a/uitest/src/main/java/com/vaadin/tests/widgetset/client/v7/grid/RowAwareRendererConnector.java b/uitest/src/main/java/com/vaadin/tests/widgetset/client/grid/RowAwareRendererConnector.java index ff541b8741..dd06c005a4 100644 --- a/uitest/src/main/java/com/vaadin/tests/widgetset/client/v7/grid/RowAwareRendererConnector.java +++ b/uitest/src/main/java/com/vaadin/tests/widgetset/client/grid/RowAwareRendererConnector.java @@ -13,7 +13,7 @@ * License for the specific language governing permissions and limitations under * the License. */ -package com.vaadin.tests.widgetset.client.v7.grid; +package com.vaadin.tests.widgetset.client.grid; import java.util.Arrays; import java.util.Collection; @@ -22,24 +22,25 @@ import com.google.gwt.dom.client.BrowserEvents; import com.google.gwt.dom.client.DivElement; import com.google.gwt.dom.client.NativeEvent; import com.google.gwt.user.client.DOM; +import com.vaadin.client.connectors.grid.AbstractGridRendererConnector; +import com.vaadin.client.renderers.ComplexRenderer; +import com.vaadin.client.renderers.Renderer; +import com.vaadin.client.widget.grid.CellReference; +import com.vaadin.client.widget.grid.RendererCellReference; import com.vaadin.shared.communication.ServerRpc; import com.vaadin.shared.ui.Connect; -import com.vaadin.v7.client.connectors.AbstractGridRendererConnector; -import com.vaadin.v7.client.renderers.ComplexRenderer; -import com.vaadin.v7.client.renderers.Renderer; -import com.vaadin.v7.client.widget.grid.CellReference; -import com.vaadin.v7.client.widget.grid.RendererCellReference; +import com.vaadin.tests.widgetset.client.EmptyEnum; import elemental.json.JsonObject; -@Connect(com.vaadin.v7.tests.components.grid.RowAwareRenderer.class) +@Connect(com.vaadin.tests.components.grid.RowAwareRenderer.class) public class RowAwareRendererConnector - extends AbstractGridRendererConnector<Void> { + extends AbstractGridRendererConnector<EmptyEnum> { public interface RowAwareRendererRpc extends ServerRpc { void clicky(String key); } - public class RowAwareRenderer extends ComplexRenderer<Void> { + public class RowAwareRenderer extends ComplexRenderer<EmptyEnum> { @Override public Collection<String> getConsumedEvents() { @@ -56,7 +57,7 @@ public class RowAwareRendererConnector } @Override - public void render(RendererCellReference cell, Void data) { + public void render(RendererCellReference cell, EmptyEnum data) { // NOOP } @@ -72,7 +73,7 @@ public class RowAwareRendererConnector } @Override - protected Renderer<Void> createRenderer() { + protected Renderer<EmptyEnum> createRenderer() { // cannot use the default createRenderer as RowAwareRenderer needs a // reference to its connector - it has no "real" no-argument constructor return new RowAwareRenderer(); diff --git a/uitest/src/main/java/com/vaadin/v7/tests/components/grid/CustomRenderer.java b/uitest/src/main/java/com/vaadin/v7/tests/components/grid/CustomRenderer.java deleted file mode 100644 index 5c7d1deb1b..0000000000 --- a/uitest/src/main/java/com/vaadin/v7/tests/components/grid/CustomRenderer.java +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Copyright 2000-2016 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.v7.tests.components.grid; - -import com.vaadin.annotations.Widgetset; -import com.vaadin.server.VaadinRequest; -import com.vaadin.tests.components.AbstractReindeerTestUI; -import com.vaadin.tests.widgetset.TestingWidgetSet; -import com.vaadin.tests.widgetset.client.SimpleTestBean; -import com.vaadin.ui.Label; -import com.vaadin.v7.data.Item; -import com.vaadin.v7.data.Property; -import com.vaadin.v7.data.util.IndexedContainer; -import com.vaadin.v7.ui.Grid; -import com.vaadin.v7.ui.Grid.SelectionMode; - -@Widgetset(TestingWidgetSet.NAME) -public class CustomRenderer extends AbstractReindeerTestUI { - - private static final Object INT_ARRAY_PROPERTY = "int array"; - private static final Object VOID_PROPERTY = "void"; - private static final Object BEAN_PROPERTY = "pojo"; - - static final Object ITEM_ID = "itemId1"; - static final String DEBUG_LABEL_ID = "debuglabel"; - static final String INIT_DEBUG_LABEL_CAPTION = "Debug label placeholder"; - - @Override - protected void setup(VaadinRequest request) { - IndexedContainer container = new IndexedContainer(); - container.addContainerProperty(INT_ARRAY_PROPERTY, int[].class, - new int[] {}); - container.addContainerProperty(VOID_PROPERTY, Void.class, null); - container.addContainerProperty(BEAN_PROPERTY, SimpleTestBean.class, - null); - - Item item = container.addItem(ITEM_ID); - - @SuppressWarnings("unchecked") - Property<int[]> propertyIntArray = item - .getItemProperty(INT_ARRAY_PROPERTY); - propertyIntArray.setValue(new int[] { 1, 1, 2, 3, 5, 8, 13 }); - - @SuppressWarnings("unchecked") - Property<SimpleTestBean> propertyPojo = item - .getItemProperty(BEAN_PROPERTY); - SimpleTestBean bean = new SimpleTestBean(); - bean.setValue(42); - propertyPojo.setValue(bean); - - Label debugLabel = new Label(INIT_DEBUG_LABEL_CAPTION); - debugLabel.setId(DEBUG_LABEL_ID); - - Grid grid = new Grid(container); - - grid.getColumn(INT_ARRAY_PROPERTY).setRenderer(new IntArrayRenderer()); - grid.getColumn(VOID_PROPERTY) - .setRenderer(new RowAwareRenderer(debugLabel)); - grid.getColumn(BEAN_PROPERTY).setRenderer(new BeanRenderer()); - - grid.setSelectionMode(SelectionMode.NONE); - - addComponent(grid); - addComponent(debugLabel); - } - - @Override - protected String getTestDescription() { - return "Verifies that renderers operating on other data than " - + "just Strings also work "; - } - - @Override - protected Integer getTicketNumber() { - return Integer.valueOf(13334); - } - -} diff --git a/uitest/src/main/java/com/vaadin/v7/tests/components/grid/GridAddAndRemoveDataOnInit.java b/uitest/src/main/java/com/vaadin/v7/tests/components/grid/GridAddAndRemoveDataOnInit.java deleted file mode 100644 index d759bb27ad..0000000000 --- a/uitest/src/main/java/com/vaadin/v7/tests/components/grid/GridAddAndRemoveDataOnInit.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright 2000-2016 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.v7.tests.components.grid; - -import com.vaadin.server.VaadinRequest; -import com.vaadin.tests.components.AbstractReindeerTestUI; -import com.vaadin.v7.data.Container.Indexed; -import com.vaadin.v7.data.util.IndexedContainer; -import com.vaadin.v7.ui.Grid; - -public class GridAddAndRemoveDataOnInit extends AbstractReindeerTestUI { - - @Override - protected void setup(VaadinRequest request) { - Grid gridAdd = new Grid(); - gridAdd.setHeight("240px"); - gridAdd.setWidth("140px"); - addComponent(gridAdd); - Indexed dataSource = gridAdd.getContainerDataSource(); - dataSource.addContainerProperty("foo", Integer.class, 0); - for (int i = 0; i < 10; ++i) { - Object id = dataSource.addItem(); - dataSource.getItem(id).getItemProperty("foo").setValue(i); - } - dataSource = new IndexedContainer(); - dataSource.addContainerProperty("bar", Integer.class, 0); - for (int i = 0; i < 10; ++i) { - Object id = dataSource.addItem(); - dataSource.getItem(id).getItemProperty("bar").setValue(i); - } - Grid gridRemove = new Grid(dataSource); - gridRemove.setHeight("150px"); - gridRemove.setWidth("140px"); - addComponent(gridRemove); - for (int i = 0; i < 5; ++i) { - dataSource.removeItem(dataSource.getIdByIndex(i)); - } - } - - @Override - protected String getTestDescription() { - return "Foo"; - } - - @Override - protected Integer getTicketNumber() { - return 13334; - } -} 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 deleted file mode 100644 index f2255389c2..0000000000 --- a/uitest/src/main/java/com/vaadin/v7/tests/components/grid/GridApplyFilterWhenScrolledDown.java +++ /dev/null @@ -1,62 +0,0 @@ -package com.vaadin.v7.tests.components.grid; - -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; - -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/test/java/com/vaadin/v7/tests/components/grid/CustomRendererTest.java b/uitest/src/test/java/com/vaadin/tests/components/grid/CustomRendererTest.java index c812e4a942..4e79de561e 100644 --- a/uitest/src/test/java/com/vaadin/v7/tests/components/grid/CustomRendererTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/grid/CustomRendererTest.java @@ -13,7 +13,7 @@ * License for the specific language governing permissions and limitations under * the License. */ -package com.vaadin.v7.tests.components.grid; +package com.vaadin.tests.components.grid; import static org.junit.Assert.assertEquals; @@ -43,13 +43,11 @@ public class CustomRendererTest extends MultiBrowserTest { GridElement grid = findGrid(); assertEquals("Click me!", grid.getCell(0, 1).getText()); - assertEquals(CustomRenderer.INIT_DEBUG_LABEL_CAPTION, - findDebugLabel().getText()); + assertEquals("Debug label placeholder", findDebugLabel().getText()); grid.getCell(0, 1).click(); assertEquals("row: 0, key: 1", grid.getCell(0, 1).getText()); - assertEquals("key: 1, itemId: " + CustomRenderer.ITEM_ID, - findDebugLabel().getText()); + assertEquals("key: 1, itemId: test-data", findDebugLabel().getText()); } @Test @@ -65,6 +63,11 @@ public class CustomRendererTest extends MultiBrowserTest { } private LabelElement findDebugLabel() { - return $(LabelElement.class).id(CustomRenderer.DEBUG_LABEL_ID); + return $(LabelElement.class).id("debuglabel"); + } + + @Override + protected Class<?> getUIClass() { + return CustomRendererUI.class; } } diff --git a/uitest/src/test/java/com/vaadin/v7/tests/components/grid/GridAddRowTest.java b/uitest/src/test/java/com/vaadin/tests/smoke/GridSmokeTest.java index 928aa9334a..495919f00b 100644 --- a/uitest/src/test/java/com/vaadin/v7/tests/components/grid/GridAddRowTest.java +++ b/uitest/src/test/java/com/vaadin/tests/smoke/GridSmokeTest.java @@ -13,7 +13,7 @@ * License for the specific language governing permissions and limitations under * the License. */ -package com.vaadin.v7.tests.components.grid; +package com.vaadin.tests.smoke; import org.junit.Assert; import org.junit.Test; @@ -24,7 +24,7 @@ import com.vaadin.testbench.parallel.TestCategory; import com.vaadin.tests.tb3.MultiBrowserTest; @TestCategory("grid") -public class GridAddRowTest extends MultiBrowserTest { +public class GridSmokeTest extends MultiBrowserTest { @Test public void testAddRow() { openTestURL(); diff --git a/uitest/src/test/java/com/vaadin/v7/tests/components/grid/GridAddAndRemoveDataOnInitTest.java b/uitest/src/test/java/com/vaadin/v7/tests/components/grid/GridAddAndRemoveDataOnInitTest.java deleted file mode 100644 index 0ea6f78c95..0000000000 --- a/uitest/src/test/java/com/vaadin/v7/tests/components/grid/GridAddAndRemoveDataOnInitTest.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright 2000-2016 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.v7.tests.components.grid; - -import org.junit.Assert; -import org.junit.Test; - -import com.vaadin.testbench.By; -import com.vaadin.testbench.customelements.GridElement; -import com.vaadin.testbench.parallel.TestCategory; -import com.vaadin.tests.tb3.MultiBrowserTest; - -@TestCategory("grid") -public class GridAddAndRemoveDataOnInitTest extends MultiBrowserTest { - - @Test - public void verifyGridSizes() { - openTestURL(); - - GridElement gridAdd = $(GridElement.class).first(); - if (!gridAdd.isElementPresent(By.vaadin("#cell[9][0]")) - || gridAdd.isElementPresent(By.vaadin("#cell[10][0]"))) { - Assert.fail("Grid with added data contained incorrect rows"); - } - - GridElement gridRemove = $(GridElement.class).get(1); - if (!gridRemove.isElementPresent(By.vaadin("#cell[4][0]")) - || gridRemove.isElementPresent(By.vaadin("#cell[5][0]"))) { - Assert.fail("Grid with removed data contained incorrect rows"); - } - } - -} 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 deleted file mode 100644 index 9a14c01146..0000000000 --- a/uitest/src/test/java/com/vaadin/v7/tests/components/grid/GridApplyFilterWhenScrolledDownTest.java +++ /dev/null @@ -1,44 +0,0 @@ -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/NullRenderersTest.java b/uitest/src/test/java/com/vaadin/v7/tests/components/grid/NullRenderersTest.java index c0f74de039..036e56ea4d 100644 --- a/uitest/src/test/java/com/vaadin/v7/tests/components/grid/NullRenderersTest.java +++ b/uitest/src/test/java/com/vaadin/v7/tests/components/grid/NullRenderersTest.java @@ -20,7 +20,6 @@ import static org.junit.Assert.assertEquals; import org.junit.Test; import com.vaadin.testbench.customelements.GridElement; -import com.vaadin.testbench.elements.LabelElement; import com.vaadin.testbench.parallel.TestCategory; import com.vaadin.tests.tb3.MultiBrowserTest; @@ -58,7 +57,4 @@ public class NullRenderersTest extends MultiBrowserTest { return $(GridElement.class).id("test-grid"); } - private LabelElement findDebugLabel() { - return $(LabelElement.class).id(CustomRenderer.DEBUG_LABEL_ID); - } } |