diff options
author | Henri Sara <hesara@vaadin.com> | 2015-08-19 11:45:17 +0300 |
---|---|---|
committer | Henri Sara <hesara@vaadin.com> | 2015-08-19 11:45:17 +0300 |
commit | 7a3e03b5acd416141e1a95eae32c3808a8e5addd (patch) | |
tree | c8fe43fcf0f40df48a634c260a07e857f1277170 /uitest/src | |
parent | 554bdab01e987b09a78b23d049c0f9f9b2a2ec72 (diff) | |
parent | 4a10a70fbecdd52758ebc73512974501a02d5fdd (diff) | |
download | vaadin-framework-7a3e03b5acd416141e1a95eae32c3808a8e5addd.tar.gz vaadin-framework-7a3e03b5acd416141e1a95eae32c3808a8e5addd.zip |
Merge branch 'master-18493' into grid-unbuffered-editor
Conflicts:
client/src/com/vaadin/client/connectors/GridConnector.java
server/src/com/vaadin/data/RpcDataProviderExtension.java
server/src/com/vaadin/ui/Grid.java
Change-Id: Ie8931fbae322c93aeb409e8a6d393623ba9d9dc6
Diffstat (limited to 'uitest/src')
9 files changed, 238 insertions, 10 deletions
diff --git a/uitest/src/com/vaadin/tests/components/combobox/ComboBoxEmptyItemsKeyboardNavigation.java b/uitest/src/com/vaadin/tests/components/combobox/ComboBoxEmptyItemsKeyboardNavigation.java new file mode 100644 index 0000000000..2f96724db1 --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/combobox/ComboBoxEmptyItemsKeyboardNavigation.java @@ -0,0 +1,15 @@ +package com.vaadin.tests.components.combobox; + +import com.vaadin.server.VaadinRequest; +import com.vaadin.tests.components.AbstractTestUI; +import com.vaadin.ui.ComboBox; + +public class ComboBoxEmptyItemsKeyboardNavigation extends AbstractTestUI { + @Override + protected void setup(VaadinRequest request) { + ComboBox comboBox = new ComboBox(); + comboBox.addItems("foo", "bar"); + + addComponent(comboBox); + } +} diff --git a/uitest/src/com/vaadin/tests/components/combobox/ComboBoxEmptyItemsKeyboardNavigationTest.java b/uitest/src/com/vaadin/tests/components/combobox/ComboBoxEmptyItemsKeyboardNavigationTest.java new file mode 100644 index 0000000000..c5cbc5eea6 --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/combobox/ComboBoxEmptyItemsKeyboardNavigationTest.java @@ -0,0 +1,30 @@ +package com.vaadin.tests.components.combobox; + +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.collection.IsEmptyCollection.empty; + +import java.util.List; + +import org.junit.Test; +import org.openqa.selenium.Keys; +import org.openqa.selenium.WebElement; + +import com.vaadin.testbench.By; +import com.vaadin.tests.tb3.MultiBrowserTest; +import com.vaadin.tests.tb3.newelements.ComboBoxElement; + +public class ComboBoxEmptyItemsKeyboardNavigationTest extends MultiBrowserTest { + + @Test + public void navigatingUpOnAnEmptyMenuDoesntThrowErrors() { + setDebug(true); + openTestURL(); + + ComboBoxElement combobox = $(ComboBoxElement.class).first(); + combobox.sendKeys("a", Keys.ARROW_UP); + + List<WebElement> errors = findElements(By.className("SEVERE")); + + assertThat(errors, empty()); + } +}
\ No newline at end of file diff --git a/uitest/src/com/vaadin/tests/components/combobox/ComboBoxLargeIconsTest.java b/uitest/src/com/vaadin/tests/components/combobox/ComboBoxLargeIconsTest.java new file mode 100644 index 0000000000..407ab7aa04 --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/combobox/ComboBoxLargeIconsTest.java @@ -0,0 +1,58 @@ +package com.vaadin.tests.components.combobox; + +import org.junit.Test; +import org.openqa.selenium.Keys; +import org.openqa.selenium.interactions.Actions; + +import com.vaadin.testbench.By; +import com.vaadin.testbench.elements.NativeSelectElement; +import com.vaadin.tests.tb3.MultiBrowserTest; +import com.vaadin.tests.tb3.newelements.ComboBoxElement; + +public class ComboBoxLargeIconsTest extends MultiBrowserTest { + @Override + protected Class<?> getUIClass() { + return com.vaadin.tests.components.combobox.Comboboxes.class; + } + + @Test + public void testComboBoxIcons() throws Exception { + openTestURL(); + NativeSelectElement iconSelect = $(NativeSelectElement.class).first(); + iconSelect.selectByText("16x16"); + + ComboBoxElement cb = $(ComboBoxElement.class).caption( + "Undefined wide select with 50 items").first(); + cb.openPopup(); + compareScreen("icons-16x16-page1"); + cb.openNextPage(); + compareScreen("icons-16x16-page2"); + cb.findElement(By.vaadin("#popup/item0")).click(); + compareScreen("icons-16x16-selected-1-3-5-9"); + + iconSelect.selectByText("32x32"); + cb.openPopup(); + compareScreen("icons-32x32-page2"); + + // Closes the popup + cb.openPopup(); + + iconSelect.selectByText("64x64"); + + ComboBoxElement pageLength0cb = $(ComboBoxElement.class).caption( + "Pagelength 0").first(); + pageLength0cb.openPopup(); + pageLength0cb.findElement(By.vaadin("#popup/item1")).click(); + + ComboBoxElement cb200px = $(ComboBoxElement.class).caption( + "200px wide select with 50 items").first(); + cb200px.openPopup(); + cb200px.findElement(By.vaadin("#popup/item1")).click(); + + ComboBoxElement cb150px = $(ComboBoxElement.class).caption( + "150px wide select with 5 items").first(); + new Actions(driver).sendKeys(cb150px, Keys.DOWN).perform(); + + compareScreen("icons-64x64-page1-highlight-first"); + } +} diff --git a/uitest/src/com/vaadin/tests/components/grid/GridDetailsDetachTest.java b/uitest/src/com/vaadin/tests/components/grid/GridDetailsDetachTest.java index fc79fd1b68..7406daeacd 100644 --- a/uitest/src/com/vaadin/tests/components/grid/GridDetailsDetachTest.java +++ b/uitest/src/com/vaadin/tests/components/grid/GridDetailsDetachTest.java @@ -70,4 +70,28 @@ public class GridDetailsDetachTest extends MultiBrowserTest { Assert.assertEquals("Spacer content not visible", "Extra data for Bean 5", spacers.get(1).getText()); } + + @Test + public void testDetachAndImmediateReattach() { + setDebug(true); + openTestURL(); + + $(GridElement.class).first().getCell(3, 0).click(); + $(GridElement.class).first().getCell(5, 0).click(); + + assertNoErrorNotifications(); + + // Detach and Re-attach Grid + $(ButtonElement.class).get(1).click(); + + assertNoErrorNotifications(); + + List<WebElement> spacers = findElements(By.className("v-grid-spacer")); + Assert.assertEquals("Not enough spacers in DOM", 2, spacers.size()); + Assert.assertEquals("Spacer content not visible", + "Extra data for Bean 3", spacers.get(0).getText()); + Assert.assertEquals("Spacer content not visible", + "Extra data for Bean 5", spacers.get(1).getText()); + } + } diff --git a/uitest/src/com/vaadin/tests/components/grid/basicfeatures/GridColumnHidingTest.java b/uitest/src/com/vaadin/tests/components/grid/basicfeatures/GridColumnHidingTest.java index a307aaca16..0717cd84d0 100644 --- a/uitest/src/com/vaadin/tests/components/grid/basicfeatures/GridColumnHidingTest.java +++ b/uitest/src/com/vaadin/tests/components/grid/basicfeatures/GridColumnHidingTest.java @@ -870,7 +870,10 @@ public class GridColumnHidingTest extends GridBasicClientFeaturesTest { selectMenuPath("Component", "Columns", "Column 0", "Hidable"); getSidebarOpenButton().click(); verifySidebarOpened(); - findElement(By.className("v-app")).click(); + // Click somewhere far from Grid. + new Actions(getDriver()) + .moveToElement(findElement(By.className("v-app")), 600, 600) + .click().perform(); verifySidebarClosed(); } diff --git a/uitest/src/com/vaadin/tests/components/grid/basicfeatures/client/GridDetailsClientTest.java b/uitest/src/com/vaadin/tests/components/grid/basicfeatures/client/GridDetailsClientTest.java index 88158c7f6f..1e4b8a0062 100644 --- a/uitest/src/com/vaadin/tests/components/grid/basicfeatures/client/GridDetailsClientTest.java +++ b/uitest/src/com/vaadin/tests/components/grid/basicfeatures/client/GridDetailsClientTest.java @@ -35,8 +35,8 @@ import com.vaadin.shared.ui.grid.ScrollDestination; import com.vaadin.testbench.By; import com.vaadin.testbench.ElementQuery; import com.vaadin.testbench.TestBenchElement; -import com.vaadin.testbench.elements.NotificationElement; import com.vaadin.tests.components.grid.basicfeatures.GridBasicClientFeaturesTest; +import com.vaadin.tests.tb3.newelements.FixedNotificationElement; public class GridDetailsClientTest extends GridBasicClientFeaturesTest { @@ -112,12 +112,12 @@ public class GridDetailsClientTest extends GridBasicClientFeaturesTest { @Test public void errorUpdaterShowsErrorNotification() { assertFalse("No notifications should've been at the start", - $(NotificationElement.class).exists()); + $(FixedNotificationElement.class).exists()); toggleDetailsFor(1); selectMenuPath(SET_FAULTY_GENERATOR); - ElementQuery<NotificationElement> notification = $(NotificationElement.class); + ElementQuery<FixedNotificationElement> notification = $(FixedNotificationElement.class); assertTrue("Was expecting an error notification here", notification.exists()); notification.first().close(); @@ -131,7 +131,7 @@ public class GridDetailsClientTest extends GridBasicClientFeaturesTest { toggleDetailsFor(1); selectMenuPath(SET_FAULTY_GENERATOR); - $(NotificationElement.class).first().close(); + $(FixedNotificationElement.class).first().close(); selectMenuPath(SET_GENERATOR); assertNotEquals( diff --git a/uitest/src/com/vaadin/tests/components/grid/basicfeatures/server/GridDetailsServerTest.java b/uitest/src/com/vaadin/tests/components/grid/basicfeatures/server/GridDetailsServerTest.java index 4ea64073f3..326dbcd55f 100644 --- a/uitest/src/com/vaadin/tests/components/grid/basicfeatures/server/GridDetailsServerTest.java +++ b/uitest/src/com/vaadin/tests/components/grid/basicfeatures/server/GridDetailsServerTest.java @@ -22,7 +22,6 @@ import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; import org.junit.Before; -import org.junit.Ignore; import org.junit.Test; import org.openqa.selenium.By; import org.openqa.selenium.NoSuchElementException; @@ -196,14 +195,11 @@ public class GridDetailsServerTest extends GridBasicFeaturesTest { assertEquals("Two", getGridElement().getDetails(0).getText()); } - @Ignore("This use case is not currently supported by Grid. If the detail " - + "is out of view, the component is detached from the UI and a " - + "new instance is generated when scrolled back. Support will " - + "maybe be incorporated at a later time") @Test public void hierarchyChangesWorkInDetailsWhileOutOfView() { selectMenuPath(DETAILS_GENERATOR_HIERARCHICAL); selectMenuPath(OPEN_FIRST_ITEM_DETAILS); + assertEquals("One", getGridElement().getDetails(0).getText()); scrollGridVerticallyTo(10000); selectMenuPath(CHANGE_HIERARCHY); scrollGridVerticallyTo(0); diff --git a/uitest/src/com/vaadin/tests/components/table/TableColumnWidthsAndSorting.java b/uitest/src/com/vaadin/tests/components/table/TableColumnWidthsAndSorting.java new file mode 100644 index 0000000000..8f0a8803f3 --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/table/TableColumnWidthsAndSorting.java @@ -0,0 +1,50 @@ +/* + * 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.tests.components.table; + +import com.vaadin.annotations.Theme; +import com.vaadin.server.VaadinRequest; +import com.vaadin.tests.components.AbstractTestUIWithLog; +import com.vaadin.tests.fieldgroup.ComplexPerson; +import com.vaadin.ui.Button; +import com.vaadin.ui.Button.ClickEvent; +import com.vaadin.ui.Button.ClickListener; +import com.vaadin.ui.Table; + +@Theme("valo") +public class TableColumnWidthsAndSorting extends AbstractTestUIWithLog { + + @Override + protected void setup(VaadinRequest request) { + final Table t = new Table(); + t.setContainerDataSource(ComplexPerson.createContainer(100)); + t.setVisibleColumns("firstName", "lastName", "age", "gender", "salary"); + t.setColumnWidth("firstName", 200); + t.setColumnWidth("lastName", 200); + t.setSelectable(true); + addComponent(t); + + Button b = new Button("Sort according to gender", new ClickListener() { + + @Override + public void buttonClick(ClickEvent event) { + t.sort(new Object[] { "gender" }, new boolean[] { true }); + } + }); + + addComponent(b); + } +} diff --git a/uitest/src/com/vaadin/tests/components/table/TableColumnWidthsAndSortingTest.java b/uitest/src/com/vaadin/tests/components/table/TableColumnWidthsAndSortingTest.java new file mode 100644 index 0000000000..9c49b3d0b6 --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/table/TableColumnWidthsAndSortingTest.java @@ -0,0 +1,52 @@ +/* + * 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.tests.components.table; + +import org.junit.Assert; +import org.junit.Test; + +import com.vaadin.testbench.elements.TableElement; +import com.vaadin.tests.tb3.MultiBrowserTest; + +public class TableColumnWidthsAndSortingTest extends MultiBrowserTest { + + @Test + public void testHeaderHeight() { + openTestURL(); + TableElement t = $(TableElement.class).first(); + + assertHeaderCellHeight(t); + + // Sort according to age + t.getHeaderCell(2).click(); + assertHeaderCellHeight(t); + + // Sort again according to age + t.getHeaderCell(2).click(); + assertHeaderCellHeight(t); + + } + + private void assertHeaderCellHeight(TableElement t) { + // Assert all headers are correct height (37px according to default + // Valo) + for (int i = 0; i < 5; i++) { + Assert.assertEquals("Height of header cell " + i + " is wrong", 37, + t.getHeaderCell(0).getSize().getHeight()); + } + + } +} |