aboutsummaryrefslogtreecommitdiffstats
path: root/uitest/src/com/vaadin/tests/components
diff options
context:
space:
mode:
authorTeemu Suo-Anttila <teemusa@vaadin.com>2015-04-15 10:24:44 +0300
committerTeemu Suo-Anttila <teemusa@vaadin.com>2015-04-15 10:24:44 +0300
commit2c4e533c9f2aa68211329ea6ce4de0b577407863 (patch)
tree1d9c1cc8bb72678b0edb991947c6fc94112baf0f /uitest/src/com/vaadin/tests/components
parent93235f05c9dd4739cdccf87a4858a61904dbf4b5 (diff)
parent7cb23bc63f794a7549dd79c37da2f8bb8e88e20d (diff)
downloadvaadin-framework-2c4e533c9f2aa68211329ea6ce4de0b577407863.tar.gz
vaadin-framework-2c4e533c9f2aa68211329ea6ce4de0b577407863.zip
Merge remote-tracking branch 'origin/master' into grid-7.5
Change-Id: I03fdd2014fd0393341db0f650c065f6d27905b73
Diffstat (limited to 'uitest/src/com/vaadin/tests/components')
-rw-r--r--uitest/src/com/vaadin/tests/components/TouchDevicesTooltip.java66
-rw-r--r--uitest/src/com/vaadin/tests/components/colorpicker/DefaultCaptionWidth.java72
-rw-r--r--uitest/src/com/vaadin/tests/components/colorpicker/DefaultCaptionWidthTest.java67
-rw-r--r--uitest/src/com/vaadin/tests/components/combobox/ComboBoxMouseSelectEnter.java66
-rw-r--r--uitest/src/com/vaadin/tests/components/combobox/ComboBoxMouseSelectEnterTest.java105
-rw-r--r--uitest/src/com/vaadin/tests/components/grid/GridHeaderFormatChange.java183
-rw-r--r--uitest/src/com/vaadin/tests/components/grid/GridHeaderFormatChangeTest.java156
-rw-r--r--uitest/src/com/vaadin/tests/components/gridlayout/GridLayoutCellSizesUI.java53
-rw-r--r--uitest/src/com/vaadin/tests/components/gridlayout/GridLayoutCellSizesUITest.java111
-rw-r--r--uitest/src/com/vaadin/tests/components/notification/ChromeBottomNotification.java33
-rw-r--r--uitest/src/com/vaadin/tests/components/table/TableContextMenuTouch.java106
11 files changed, 1018 insertions, 0 deletions
diff --git a/uitest/src/com/vaadin/tests/components/TouchDevicesTooltip.java b/uitest/src/com/vaadin/tests/components/TouchDevicesTooltip.java
new file mode 100644
index 0000000000..ac4b48711e
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/TouchDevicesTooltip.java
@@ -0,0 +1,66 @@
+package com.vaadin.tests.components;
+
+import com.vaadin.annotations.Viewport;
+import com.vaadin.data.util.converter.StringToIntegerConverter;
+import com.vaadin.data.validator.IntegerRangeValidator;
+import com.vaadin.server.VaadinRequest;
+import com.vaadin.ui.Label;
+import com.vaadin.ui.TextField;
+
+import javax.validation.constraints.Min;
+import javax.validation.constraints.NotNull;
+
+@Viewport(value = "width=device-width,height=device-height")
+public class TouchDevicesTooltip extends AbstractTestUI {
+
+ @Override
+ protected void setup(VaadinRequest request) {
+ final Label errorLabel = new Label("No error");
+ addComponent(errorLabel);
+
+ for (int i = 0; i < 50; i++) {
+ createTextField(i);
+ }
+ }
+
+ private void createTextField(int n) {
+ TextField textField = new TextField("Value" + n);
+ textField.setConverter(new StringToIntegerConverter());
+ textField.addValidator(new IntegerRangeValidator(getErrorMessage(n), 0, 100));
+ textField.setImmediate(true);
+ textField.setValue("-5");
+ addComponent(textField);
+ }
+
+ private String getErrorMessage(int n) {
+ if(n % 2 == 0) {
+ return "incorrect value" + n;
+ } else {
+ return "super long long long long long long long long long long long error message " + n;
+ }
+ }
+
+ public static class Bean {
+ @NotNull
+ @Min(0)
+ private Integer value;
+
+ public Integer getValue() {
+ return value;
+ }
+
+ public void setValue(Integer value) {
+ this.value = value;
+ }
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return 17150;
+ }
+
+ @Override
+ public String getDescription() {
+ return "Unable to dismiss a tooltip on touch devices";
+ }
+} \ No newline at end of file
diff --git a/uitest/src/com/vaadin/tests/components/colorpicker/DefaultCaptionWidth.java b/uitest/src/com/vaadin/tests/components/colorpicker/DefaultCaptionWidth.java
new file mode 100644
index 0000000000..d3dd0aeccc
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/colorpicker/DefaultCaptionWidth.java
@@ -0,0 +1,72 @@
+/*
+ * 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.colorpicker;
+
+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.ColorPicker;
+
+/**
+ * Test for color picker with default caption.
+ *
+ * @author Vaadin Ltd
+ */
+public class DefaultCaptionWidth extends AbstractTestUI {
+
+ @Override
+ protected void setup(VaadinRequest request) {
+ final ColorPicker colorPicker = new ColorPicker();
+ addComponent(colorPicker);
+ colorPicker.setDefaultCaptionEnabled(true);
+
+ Button setWidth = new Button("Set explicit width",
+ new Button.ClickListener() {
+
+ @Override
+ public void buttonClick(ClickEvent event) {
+ colorPicker.setCaption(null);
+ colorPicker.setWidth("150px");
+ }
+ });
+ setWidth.addStyleName("set-width");
+ addComponent(setWidth);
+
+ Button setCaption = new Button("Set explicit caption",
+ new Button.ClickListener() {
+
+ @Override
+ public void buttonClick(ClickEvent event) {
+ colorPicker.setCaption("caption");
+ colorPicker.setWidthUndefined();
+ }
+ });
+ setCaption.addStyleName("set-caption");
+ addComponent(setCaption);
+
+ }
+
+ @Override
+ protected String getTestDescription() {
+ return "Color picker with default caption enabled should get appropriate style";
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return 17140;
+ }
+}
diff --git a/uitest/src/com/vaadin/tests/components/colorpicker/DefaultCaptionWidthTest.java b/uitest/src/com/vaadin/tests/components/colorpicker/DefaultCaptionWidthTest.java
new file mode 100644
index 0000000000..78b7120b4e
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/colorpicker/DefaultCaptionWidthTest.java
@@ -0,0 +1,67 @@
+/*
+ * 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.colorpicker;
+
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.openqa.selenium.By;
+
+import com.vaadin.testbench.elements.ColorPickerElement;
+import com.vaadin.tests.tb3.MultiBrowserTest;
+
+/**
+ * Test for default caption behavior in color picker.
+ *
+ * @author Vaadin Ltd
+ */
+public class DefaultCaptionWidthTest extends MultiBrowserTest {
+
+ @Before
+ public void setUp() {
+ openTestURL();
+ }
+
+ @Test
+ public void setDefaultCaption_sizeAndCaptionAreNotSet_pickerGetsStyle() {
+ checkStylePresence(true);
+ }
+
+ @Test
+ public void setDefaultCaption_explicitSizeIsSet_pickerNoCaptionStyle() {
+ findElement(By.className("set-width")).click();
+ checkStylePresence(false);
+ }
+
+ @Test
+ public void setDefaultCaption_explicitCaptionIsSet_pickerNoCaptionStyle() {
+ findElement(By.className("set-caption")).click();
+ checkStylePresence(false);
+ }
+
+ protected void checkStylePresence(boolean expectedStyle) {
+ String clazz = $(ColorPickerElement.class).first()
+ .getAttribute("class");
+ if (expectedStyle) {
+ Assert.assertTrue("Default caption style is not found",
+ clazz.contains("v-default-caption-width"));
+ } else {
+ Assert.assertFalse("Found unexpected default caption style",
+ clazz.contains("v-default-caption-width"));
+ }
+ }
+
+}
diff --git a/uitest/src/com/vaadin/tests/components/combobox/ComboBoxMouseSelectEnter.java b/uitest/src/com/vaadin/tests/components/combobox/ComboBoxMouseSelectEnter.java
new file mode 100644
index 0000000000..5af4749349
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/combobox/ComboBoxMouseSelectEnter.java
@@ -0,0 +1,66 @@
+/*
+ * 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.combobox;
+
+import com.vaadin.data.Property;
+import com.vaadin.server.VaadinRequest;
+import com.vaadin.tests.components.AbstractTestUI;
+import com.vaadin.ui.ComboBox;
+import com.vaadin.ui.Label;
+
+public class ComboBoxMouseSelectEnter extends AbstractTestUI {
+ protected ComboBox comboBox;
+
+ @Override
+ protected void setup(VaadinRequest request) {
+ comboBox = new ComboBox();
+ final Label label = new Label();
+ label.setId("value");
+
+ comboBox.setTextInputAllowed(true);
+ comboBox.setNullSelectionAllowed(true);
+ comboBox.setNullSelectionItemId(null);
+
+ for (int i = 0; i < 10; i++) {
+ comboBox.addItem("a" + i);
+ }
+
+ comboBox.addValueChangeListener(new Property.ValueChangeListener() {
+ @Override
+ public void valueChange(Property.ValueChangeEvent event) {
+ Object value = event.getProperty().getValue();
+ if (value != null) {
+ label.setValue(value.toString());
+ } else {
+ label.setValue("null");
+ }
+ }
+ });
+
+ addComponents(comboBox);
+ addComponent(label);
+ }
+
+ @Override
+ protected String getTestDescription() {
+ return "Pressing Enter should set value highlighted from mouse position after using arrow keys";
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return 16981;
+ }
+}
diff --git a/uitest/src/com/vaadin/tests/components/combobox/ComboBoxMouseSelectEnterTest.java b/uitest/src/com/vaadin/tests/components/combobox/ComboBoxMouseSelectEnterTest.java
new file mode 100644
index 0000000000..d3ba37682d
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/combobox/ComboBoxMouseSelectEnterTest.java
@@ -0,0 +1,105 @@
+/*
+ * 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.combobox;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.MatcherAssert.assertThat;
+
+import java.util.List;
+
+import org.junit.Test;
+import org.openqa.selenium.Keys;
+import org.openqa.selenium.WebDriver;
+import org.openqa.selenium.WebElement;
+import org.openqa.selenium.interactions.Actions;
+import org.openqa.selenium.support.ui.ExpectedCondition;
+
+import com.vaadin.testbench.By;
+import com.vaadin.testbench.elements.LabelElement;
+import com.vaadin.testbench.parallel.BrowserUtil;
+import com.vaadin.tests.tb3.MultiBrowserTest;
+import com.vaadin.tests.tb3.newelements.ComboBoxElement;
+
+public class ComboBoxMouseSelectEnterTest extends MultiBrowserTest {
+
+ private ComboBoxElement comboBoxElement;
+
+ @Override
+ public void setup() throws Exception {
+
+ super.setup();
+ openTestURL();
+ waitForElementPresent(By.className("v-filterselect"));
+ comboBoxElement = $(ComboBoxElement.class).first();
+ }
+
+ @Test
+ public void enterSetsValueSelectedByMouseOver() {
+ comboBoxElement.openPopup();
+ comboBoxElement.sendKeys(Keys.DOWN, Keys.DOWN);
+ String selectedItemText = findElement(
+ By.className("gwt-MenuItem-selected")).getText();
+ assertThat("Item selected by arrows should be a1", selectedItemText,
+ is("a1"));
+ new Actions(driver).moveToElement(getWebElementForItem("a5")).build()
+ .perform();
+ comboBoxElement.sendKeys(getReturn());
+ assertThat("Item selected by mouse should be a5",
+ comboBoxElement.getText(), is("a5"));
+ checkLabelValue("a5");
+ }
+
+ private WebElement getWebElementForItem(String wantedText) {
+ WebElement wantedItem = null;
+ List<WebElement> items = findElements(By.className("gwt-MenuItem"));
+ for (WebElement item : items) {
+ if (item.getText().equals(wantedText)) {
+ wantedItem = item;
+ break;
+ }
+ }
+ return wantedItem;
+ }
+
+ private Keys getReturn() {
+ if (BrowserUtil.isPhantomJS(getDesiredCapabilities())) {
+ return Keys.ENTER;
+ } else {
+ return Keys.RETURN;
+ }
+ }
+
+ private void checkLabelValue(final String expectedValue) {
+
+ waitUntil(new ExpectedCondition<Boolean>() {
+ private String actualValue;
+
+ @Override
+ public Boolean apply(WebDriver input) {
+ actualValue = $(LabelElement.class).id("value").getText();
+ return actualValue.equals(expectedValue);
+ }
+
+ @Override
+ public String toString() {
+ // Timed out after 10 seconds waiting for ...
+ return String.format("Label value to match '%s' (was: '%s')",
+ expectedValue, actualValue);
+ }
+ });
+ }
+
+} \ No newline at end of file
diff --git a/uitest/src/com/vaadin/tests/components/grid/GridHeaderFormatChange.java b/uitest/src/com/vaadin/tests/components/grid/GridHeaderFormatChange.java
new file mode 100644
index 0000000000..fbd6a42a38
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/grid/GridHeaderFormatChange.java
@@ -0,0 +1,183 @@
+/*
+ * 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.grid;
+
+import java.io.Serializable;
+
+import com.vaadin.data.util.BeanItemContainer;
+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.Grid;
+import com.vaadin.ui.Grid.HeaderRow;
+import com.vaadin.ui.Grid.SelectionMode;
+import com.vaadin.ui.Grid.SelectionModel;
+import com.vaadin.ui.HorizontalLayout;
+import com.vaadin.ui.renderers.NumberRenderer;
+
+public class GridHeaderFormatChange extends AbstractTestUI {
+
+ private static final long serialVersionUID = -2787771187365766027L;
+
+ private HeaderRow row;
+
+ public class Person implements Serializable {
+ private static final long serialVersionUID = -7995927620756317000L;
+
+ String firstName;
+ String lastName;
+ String streetAddress;
+ Integer zipCode;
+ String city;
+
+ public Person(String firstName, String lastName, String streetAddress,
+ Integer zipCode, String city) {
+ this.firstName = firstName;
+ this.lastName = lastName;
+ this.streetAddress = streetAddress;
+ this.zipCode = zipCode;
+ this.city = city;
+ }
+
+ public String getFirstName() {
+ return firstName;
+ }
+
+ public void setFirstName(String firstName) {
+ this.firstName = firstName;
+ }
+
+ public String getLastName() {
+ return lastName;
+ }
+
+ public void setLastName(String lastName) {
+ this.lastName = lastName;
+ }
+
+ public String getStreetAddress() {
+ return streetAddress;
+ }
+
+ public void setStreetAddress(String streetAddress) {
+ this.streetAddress = streetAddress;
+ }
+
+ public Integer getZipCode() {
+ return zipCode;
+ }
+
+ public void setZipCode(Integer zipCode) {
+ this.zipCode = zipCode;
+ }
+
+ public String getCity() {
+ return city;
+ }
+
+ public void setCity(String city) {
+ this.city = city;
+ }
+
+ }
+
+ @Override
+ protected void setup(VaadinRequest request) {
+ BeanItemContainer<Person> datasource = new BeanItemContainer<Person>(
+ Person.class);
+ final Grid grid;
+
+ datasource.addItem(new Person("Rudolph", "Reindeer", "Ruukinkatu 2-4",
+ 20540, "Turku"));
+
+ grid = new Grid(datasource);
+ grid.setWidth("600px");
+ grid.getColumn("zipCode").setRenderer(new NumberRenderer());
+ grid.setColumnOrder("firstName", "lastName", "streetAddress",
+ "zipCode", "city");
+ grid.setSelectionMode(SelectionMode.SINGLE);
+ addComponent(grid);
+
+ Button showHide = new Button("Hide firstName",
+ new Button.ClickListener() {
+ private static final long serialVersionUID = 8107530972693788705L;
+
+ @Override
+ public void buttonClick(ClickEvent event) {
+ if (grid.getColumn("firstName") != null) {
+ grid.removeColumn("firstName");
+ event.getButton().setCaption("Show firstName");
+ } else {
+ grid.addColumn("firstName");
+ grid.setColumnOrder("firstName", "lastName",
+ "streetAddress", "zipCode", "city");
+
+ event.getButton().setCaption("Hide firstName");
+ }
+ }
+ });
+ showHide.setId("show_hide");
+
+ Button selectionMode = new Button("Set multiselect",
+ new Button.ClickListener() {
+ private static final long serialVersionUID = 8107530972693788705L;
+
+ @Override
+ public void buttonClick(ClickEvent event) {
+ if (grid.getSelectionModel() instanceof SelectionModel.Single) {
+ grid.setSelectionMode(SelectionMode.MULTI);
+ } else {
+ grid.setSelectionMode(SelectionMode.SINGLE);
+ }
+ }
+ });
+ selectionMode.setId("selection_mode");
+
+ Button join = new Button("Add Join header column",
+ new Button.ClickListener() {
+ private static final long serialVersionUID = -5330801275551280623L;
+
+ @Override
+ public void buttonClick(ClickEvent event) {
+ if (row == null) {
+ row = grid.prependHeaderRow();
+ if (grid.getColumn("firstName") != null) {
+ row.join("firstName", "lastName").setText(
+ "Full Name");
+ }
+ row.join("streetAddress", "zipCode", "city")
+ .setText("Address");
+ } else {
+ grid.removeHeaderRow(row);
+ row = null;
+ }
+ }
+ });
+ join.setId("join");
+ addComponent(new HorizontalLayout(showHide, selectionMode, join));
+ }
+
+ @Override
+ protected String getTestDescription() {
+ return "Grid for testing header re-rendering.";
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return 17131;
+ }
+}
diff --git a/uitest/src/com/vaadin/tests/components/grid/GridHeaderFormatChangeTest.java b/uitest/src/com/vaadin/tests/components/grid/GridHeaderFormatChangeTest.java
new file mode 100644
index 0000000000..0e2a3d6ac6
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/grid/GridHeaderFormatChangeTest.java
@@ -0,0 +1,156 @@
+/*
+ * 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.grid;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.openqa.selenium.By;
+
+import com.vaadin.testbench.elements.ButtonElement;
+import com.vaadin.testbench.elements.GridElement;
+import com.vaadin.testbench.parallel.TestCategory;
+import com.vaadin.tests.tb3.MultiBrowserTest;
+
+@TestCategory("grid")
+public class GridHeaderFormatChangeTest extends MultiBrowserTest {
+
+ @Test
+ public void testHeaderRetainsSelectAllForColumnRemoval() {
+ openTestURL();
+ GridElement grid = $(GridElement.class).first();
+
+ // Assert that we do not have the select all checkbox
+ Assert.assertTrue(
+ "Found input in header even though none should exist.", grid
+ .getHeader().findElements(By.tagName("input"))
+ .isEmpty());
+
+ // Set grid into multiselection mode
+ toggleSelectionMode();
+
+ // Assert that we now have a select all checkbox in the header
+ Assert.assertFalse("Expected one input field in header", grid
+ .getHeader().findElements(By.tagName("input")).isEmpty());
+
+ // Hide the firstName column from the grid.
+ toggleFirstName();
+
+ // Assert that we still have the select all checkbox in the header.
+ Assert.assertFalse("Header was missing checkbox after hiding column",
+ grid.getHeader().findElements(By.tagName("input")).isEmpty());
+
+ // Show the firstName column.
+ toggleFirstName();
+
+ // Assert that we still have the select all checkbox in the header.
+ Assert.assertFalse(
+ "Header was missing checkbox after bringing back column", grid
+ .getHeader().findElements(By.tagName("input"))
+ .isEmpty());
+ }
+
+ @Test
+ public void testHeaderRetainsSelectAllForJoinColumnAdd() {
+ openTestURL();
+ GridElement grid = $(GridElement.class).first();
+
+ // Assert that we do not have the select all checkbox
+ Assert.assertTrue(
+ "Found input in header even though none should exist.", grid
+ .getHeader().findElements(By.tagName("input"))
+ .isEmpty());
+
+ // Set grid into multiselection mode
+ toggleSelectionMode();
+
+ // Assert that we now have a select all checkbox in the header
+ Assert.assertFalse("Expected one input field in header", grid
+ .getHeader().findElements(By.tagName("input")).isEmpty());
+
+ // Add Join columns header
+ toggleJoin();
+
+ // Assert that we still have the select all checkbox in the header.
+ Assert.assertFalse("Header was missing checkbox after hiding column",
+ grid.getHeader().findElements(By.tagName("input")).isEmpty());
+
+ // remove Join Columns header
+ toggleJoin();
+
+ // Assert that we still have the select all checkbox in the header.
+ Assert.assertFalse(
+ "Header was missing checkbox after bringing back column", grid
+ .getHeader().findElements(By.tagName("input"))
+ .isEmpty());
+ }
+
+ @Test
+ public void selectAllShouldKeepState() {
+ openTestURL();
+ GridElement grid = $(GridElement.class).first();
+
+ // Assert that we do not have the select all checkbox
+ Assert.assertTrue(
+ "Found input in header even though none should exist.", grid
+ .getHeader().findElements(By.tagName("input"))
+ .isEmpty());
+
+ // Set grid into multiselection mode
+ toggleSelectionMode();
+
+ // Assert that we now have a select all checkbox in the header
+ Assert.assertFalse("Should not be selected after adding", grid
+ .getHeader().findElement(By.tagName("input")).isSelected());
+
+ grid.getHeader().findElement(By.tagName("input")).click();
+
+ // Assert that checkbox is checked
+ assertSelectAllChecked(
+ "Not selected even though we just clicked selection", grid);
+
+ // Hide the firstName column from the grid.
+ toggleFirstName();
+
+ // Assert that checkbox is still checked
+ assertSelectAllChecked("Selection disappeared after removing column",
+ grid);
+
+ // Show the firstName column.
+ toggleFirstName();
+
+ // Assert that checkbox is still checked
+ assertSelectAllChecked("Selection disappeared after adding column",
+ grid);
+
+ }
+
+ private void assertSelectAllChecked(String message, GridElement grid) {
+ Assert.assertTrue(message,
+ grid.getHeader().findElement(By.tagName("input")).isSelected());
+ }
+
+ private void toggleSelectionMode() {
+ $(ButtonElement.class).id("selection_mode").click();
+ }
+
+ private void toggleFirstName() {
+ $(ButtonElement.class).id("show_hide").click();
+ }
+
+ private void toggleJoin() {
+ $(ButtonElement.class).id("join").click();
+ }
+}
diff --git a/uitest/src/com/vaadin/tests/components/gridlayout/GridLayoutCellSizesUI.java b/uitest/src/com/vaadin/tests/components/gridlayout/GridLayoutCellSizesUI.java
new file mode 100644
index 0000000000..d2ca7700ad
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/gridlayout/GridLayoutCellSizesUI.java
@@ -0,0 +1,53 @@
+package com.vaadin.tests.components.gridlayout;
+
+import com.vaadin.server.VaadinRequest;
+import com.vaadin.shared.ui.datefield.Resolution;
+import com.vaadin.tests.components.AbstractTestUI;
+import com.vaadin.ui.Button;
+import com.vaadin.ui.GridLayout;
+import com.vaadin.ui.InlineDateField;
+import com.vaadin.ui.Label;
+
+@SuppressWarnings("serial")
+public class GridLayoutCellSizesUI extends AbstractTestUI {
+
+ @Override
+ protected void setup(VaadinRequest request) {
+
+ // Create a 4 by 4 grid layout
+ final GridLayout grid = new GridLayout(4, 4);
+
+ // Fill out the first row using the cursor
+ grid.addComponent(new Button("R/C 1"));
+ for (int i = 0; i < 3; i++) {
+ grid.addComponent(new Button("Col " + (grid.getCursorX() + 1)));
+ }
+
+ // Fill out the first column using coordinates
+ for (int i = 1; i < 4; i++) {
+ grid.addComponent(new Button("Row " + i), 0, i);
+ }
+
+ // Add some components of various shapes.
+ grid.addComponent(new Button("3x1 button"), 1, 1, 3, 1);
+ grid.addComponent(new Label("1x2 cell"), 1, 2, 1, 3);
+ final InlineDateField date = new InlineDateField("A 2x2 date field");
+ date.setResolution(Resolution.DAY);
+ grid.addComponent(date, 2, 2, 3, 3);
+
+ grid.setMargin(true);
+ grid.setSizeUndefined();
+
+ addComponent(grid);
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return 17039;
+ }
+
+ @Override
+ protected String getTestDescription() {
+ return "Grid cells should be full size when adding borders around the cells";
+ }
+} \ No newline at end of file
diff --git a/uitest/src/com/vaadin/tests/components/gridlayout/GridLayoutCellSizesUITest.java b/uitest/src/com/vaadin/tests/components/gridlayout/GridLayoutCellSizesUITest.java
new file mode 100644
index 0000000000..8c753b1f5c
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/gridlayout/GridLayoutCellSizesUITest.java
@@ -0,0 +1,111 @@
+/*
+ * 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.gridlayout;
+
+import java.util.List;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.openqa.selenium.By;
+import org.openqa.selenium.WebElement;
+
+import com.vaadin.testbench.elements.GridLayoutElement;
+import com.vaadin.tests.tb3.MultiBrowserTest;
+
+public class GridLayoutCellSizesUITest extends MultiBrowserTest {
+
+ private List<WebElement> slots4x4;
+
+ @Override
+ public void setup() throws Exception {
+ super.setup();
+ openTestURL();
+ slots4x4 = getSlots();
+ }
+
+ @Test
+ public void equalsHeightSlotsShouldHaveTheSameHeight() {
+ // items in positions 0,1,2,3,4,5 should have the same height
+ int firstSlotHeight = getSlotHeight(0);
+ for (int i = 1; i < 6; i++) {
+ Assert.assertEquals("Cell height didn't match for cell: " + i,
+ firstSlotHeight, getSlotHeight(i));
+ }
+ }
+
+ @Test
+ public void expandedAndLargeSizeSlotsShouldNotEqualFirstSlot() {
+ int firstSlotHeight = getSlotHeight(0);
+
+ assertNotMatchesSmallHeight(firstSlotHeight, 6, "Row 2");
+ assertNotMatchesSmallHeight(firstSlotHeight, 7, "1x2 cell");
+ assertNotMatchesSmallHeight(firstSlotHeight, 8, "A 2x2 date field");
+ assertNotMatchesSmallHeight(firstSlotHeight, 9, "Row 3");
+ }
+
+ @Test
+ public void expandedRowsShouldHaveCorrectHeight() {
+ // Slots expanding over 2 rows should have the same height.
+ Assert.assertEquals("1x2 and 2x2 cell heights didn't match",
+ getSlotHeight(7), getSlotHeight(8));
+
+ // Slots on same row as the 1x2 label should have the same combined
+ // height.
+ Assert.assertEquals(
+ "1x2 and combined row two and row three cell heights didn't match",
+ getSlotHeight(7), getSlotHeight(6) + getSlotHeight(9));
+ }
+
+ @Test
+ public void expandedRowsShouldHaveCorrectWidth() {
+ // Col 2 slot should be the dame width as 1x2 cell slot
+ Assert.assertEquals(
+ "Col 2 slot was not the same width as slot for 1x2 cell",
+ getSlotWidth(1), getSlotWidth(7));
+
+ // Row one col 3 & 4 should be as wide as the 2x2 date field
+ Assert.assertEquals(
+ "2x2 date field width didn't match col 3 & col 4 combined width",
+ getSlotWidth(8), getSlotWidth(2) + getSlotWidth(3));
+
+ // 3x1 button should be as wide as 1x2cell + 2x2 data field
+ Assert.assertEquals(
+ "3x1 slot width wasn't the same as the combined slot widths of 1x2 cell and 2x2 date field",
+ getSlotWidth(5), getSlotWidth(7) + getSlotWidth(8));
+
+ }
+
+ private void assertNotMatchesSmallHeight(int firstSlotHeight, int i,
+ String id) {
+ Assert.assertNotEquals("Big slot '" + id
+ + "' matched small slots in height", firstSlotHeight,
+ getSlotHeight(i));
+ }
+
+ private int getSlotHeight(int slot) {
+ return slots4x4.get(slot).getSize().height;
+ }
+
+ private int getSlotWidth(int slot) {
+ return slots4x4.get(slot).getSize().width;
+ }
+
+ private List<WebElement> getSlots() {
+ GridLayoutElement layout = $(GridLayoutElement.class).first();
+
+ return layout.findElements(By.className("v-gridlayout-slot"));
+ }
+}
diff --git a/uitest/src/com/vaadin/tests/components/notification/ChromeBottomNotification.java b/uitest/src/com/vaadin/tests/components/notification/ChromeBottomNotification.java
new file mode 100644
index 0000000000..0fdc8df360
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/notification/ChromeBottomNotification.java
@@ -0,0 +1,33 @@
+package com.vaadin.tests.components.notification;
+
+import com.vaadin.server.VaadinRequest;
+import com.vaadin.shared.Position;
+import com.vaadin.tests.components.AbstractTestUI;
+import com.vaadin.ui.Button;
+import com.vaadin.ui.Notification;
+
+public class ChromeBottomNotification extends AbstractTestUI {
+ @Override
+ protected void setup(VaadinRequest request) {
+ addButton("Show notification", new Button.ClickListener() {
+ @Override
+ public void buttonClick(Button.ClickEvent event) {
+ Notification notification = new Notification(
+ "Hello world",
+ Notification.Type.ERROR_MESSAGE);
+ notification.setPosition(Position.BOTTOM_CENTER);
+ notification.show(getPage());
+ }
+ });
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return 17252;
+ }
+
+ @Override
+ public String getDescription() {
+ return "Bottom notification on Chrome goes up to top";
+ }
+}
diff --git a/uitest/src/com/vaadin/tests/components/table/TableContextMenuTouch.java b/uitest/src/com/vaadin/tests/components/table/TableContextMenuTouch.java
new file mode 100644
index 0000000000..1d909d101e
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/table/TableContextMenuTouch.java
@@ -0,0 +1,106 @@
+package com.vaadin.tests.components.table;
+
+import com.vaadin.data.Property.ValueChangeEvent;
+import com.vaadin.data.Property.ValueChangeListener;
+import com.vaadin.event.Action;
+import com.vaadin.server.VaadinRequest;
+import com.vaadin.tests.components.AbstractTestUI;
+import com.vaadin.ui.CheckBox;
+import com.vaadin.ui.HorizontalLayout;
+import com.vaadin.ui.Notification;
+import com.vaadin.ui.Table;
+import com.vaadin.ui.VerticalLayout;
+
+/*
+ * Differs from TableContextMenu by number of items, their numbering and
+ * immediate/selectable/multiselect toggling
+ */
+public class TableContextMenuTouch extends AbstractTestUI {
+
+ private static final Action ACTION_MYACTION = new Action("Action!!");
+
+ @Override
+ protected void setup(VaadinRequest req) {
+
+ HorizontalLayout hlay = new HorizontalLayout();
+ addComponent(hlay);
+ hlay.setSpacing(true);
+
+ final Table table = new Table();
+
+ table.addActionHandler(new Action.Handler() {
+ @Override
+ public void handleAction(Action action, Object sender, Object target) {
+ Notification.show("Done that :-)");
+ }
+
+ @Override
+ public Action[] getActions(Object target, Object sender) {
+ return new Action[] { ACTION_MYACTION };
+ }
+ });
+
+ table.addContainerProperty("Foo", String.class, "BAR1");
+ table.addContainerProperty("Bar", String.class, "FOO2");
+
+ table.setHeight("200px");
+
+ for (int i = 0; i < 30; i++) {
+ Object key = table.addItem();
+ table.getItem(key).getItemProperty("Foo")
+ .setValue(new Integer(i).toString());
+ }
+
+ hlay.addComponent(table);
+
+ VerticalLayout vlay = new VerticalLayout();
+ hlay.addComponent(vlay);
+
+ final CheckBox immediateCheckBox = new CheckBox("Immediate");
+ vlay.addComponent(immediateCheckBox);
+ immediateCheckBox.addValueChangeListener(new ValueChangeListener() {
+ @Override
+ public void valueChange(ValueChangeEvent event) {
+ table.setImmediate(immediateCheckBox.getValue());
+ }
+ });
+ immediateCheckBox.setValue(true);
+ table.setImmediate(immediateCheckBox.getValue());
+
+ final CheckBox selectableCheckBox = new CheckBox("Selectable");
+ final CheckBox multiselectCheckBox = new CheckBox("Multiselect");
+ vlay.addComponent(selectableCheckBox);
+ selectableCheckBox.addValueChangeListener(new ValueChangeListener() {
+ @Override
+ public void valueChange(ValueChangeEvent event) {
+ table.setSelectable(selectableCheckBox.getValue());
+ multiselectCheckBox.setEnabled(selectableCheckBox.getValue());
+ }
+ });
+ selectableCheckBox.setValue(true);
+ multiselectCheckBox.setEnabled(selectableCheckBox.getValue());
+ table.setSelectable(selectableCheckBox.getValue());
+
+ vlay.addComponent(multiselectCheckBox);
+ multiselectCheckBox.addValueChangeListener(new ValueChangeListener() {
+ @Override
+ public void valueChange(ValueChangeEvent event) {
+ table.setMultiSelect(multiselectCheckBox.getValue());
+ }
+ });
+ multiselectCheckBox.setValue(true);
+ table.setMultiSelect(multiselectCheckBox.getValue());
+
+ }
+
+ @Override
+ protected String getTestDescription() {
+ return "Context menu in Table on touch devices should not open on selection tapping";
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return 15297;
+ }
+
+} \ No newline at end of file