diff options
author | Patrik Lindström <patrik@vaadin.com> | 2016-11-02 11:54:49 +0200 |
---|---|---|
committer | Pekka Hyvönen <pekka@vaadin.com> | 2016-11-17 10:05:47 +0000 |
commit | 9a0b4e9827cdcdb4084fb6b61ab7cd8953ee94fb (patch) | |
tree | 4dd3d79b60919eca46eff6fa37de9bb23ce30e53 /uitest | |
parent | 9696c66041d9852a97aa553485afcca354d684d3 (diff) | |
download | vaadin-framework-9a0b4e9827cdcdb4084fb6b61ab7cd8953ee94fb.tar.gz vaadin-framework-9a0b4e9827cdcdb4084fb6b61ab7cd8953ee94fb.zip |
Add lazy/simple resize mode to Grid (#20108)
Change-Id: I47427efc28c350382dba8c1f50fd332a3f4585e4
Diffstat (limited to 'uitest')
2 files changed, 82 insertions, 0 deletions
diff --git a/uitest/src/main/java/com/vaadin/tests/components/grid/basicfeatures/GridBasicFeatures.java b/uitest/src/main/java/com/vaadin/tests/components/grid/basicfeatures/GridBasicFeatures.java index 18cfb56660..e3fdd68ed6 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/grid/basicfeatures/GridBasicFeatures.java +++ b/uitest/src/main/java/com/vaadin/tests/components/grid/basicfeatures/GridBasicFeatures.java @@ -44,6 +44,7 @@ import com.vaadin.event.SelectionEvent.SelectionListener; import com.vaadin.event.SortEvent; import com.vaadin.event.SortEvent.SortListener; import com.vaadin.shared.data.sort.SortDirection; +import com.vaadin.shared.ui.grid.ColumnResizeMode; import com.vaadin.shared.ui.grid.GridStaticCellType; import com.vaadin.shared.ui.grid.HeightMode; import com.vaadin.tests.components.AbstractComponentTest; @@ -1266,6 +1267,13 @@ public class GridBasicFeatures extends AbstractComponentTest<Grid> { grid.getColumns().get(0).setMaximumWidth(30); } }, null); + + createBooleanAction("Simple resize mode", "Columns", false, new Command<Grid, Boolean>() { + @Override + public void execute(Grid g, Boolean value, Object data) { + g.setColumnResizeMode(value ? ColumnResizeMode.SIMPLE : ColumnResizeMode.ANIMATED); + } + }); } private static String getColumnProperty(int c) { diff --git a/uitest/src/test/java/com/vaadin/tests/components/grid/basicfeatures/GridColumnResizeModeTest.java b/uitest/src/test/java/com/vaadin/tests/components/grid/basicfeatures/GridColumnResizeModeTest.java new file mode 100644 index 0000000000..8e767eb033 --- /dev/null +++ b/uitest/src/test/java/com/vaadin/tests/components/grid/basicfeatures/GridColumnResizeModeTest.java @@ -0,0 +1,74 @@ +package com.vaadin.tests.components.grid.basicfeatures;/* + * 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. + */ + +import java.util.List; + +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; +import org.openqa.selenium.WebElement; +import org.openqa.selenium.interactions.Actions; + +import com.vaadin.testbench.By; +import com.vaadin.testbench.parallel.TestCategory; +import com.vaadin.tests.components.grid.basicfeatures.element.CustomGridElement; + +@TestCategory("grid") +public class GridColumnResizeModeTest extends GridBasicFeaturesTest { + + @Before + public void before() { + openTestURL(); + } + + @Test + public void testSimpleResizeModeToggle() throws Exception { + + CustomGridElement grid = getGridElement(); + + List<WebElement> handles = grid.findElements(By.className("v-grid-column-resize-handle")); + WebElement handle = handles.get(1); + + Actions drag1 = new Actions(getDriver()).moveToElement(handle).clickAndHold(); + Actions drag2 = new Actions(getDriver()).moveByOffset(-50, 0); + Actions drag3 = new Actions(getDriver()).moveByOffset(100, 0); + Actions dragEndAction = new Actions(getDriver()).release().moveToElement(grid); + + selectMenuPath("Component", "Columns", "Simple resize mode"); + sleep(250); + + drag1.perform(); + sleep(500); + drag2.perform(); + sleep(500); + drag3.perform(); + sleep(500); + + // Make sure we find at least one simple resize mode splitter + assertElementPresent(By.className("v-grid-column-resize-simple-indicator")); + + dragEndAction.perform(); + + // Make sure it went away + assertElementNotPresent(By.className("v-grid-column-resize-simple-indicator")); + + // See that we got a resize event + sleep(500); + Assert.assertEquals("Log shows resize event", getLogRow(0), "3. ColumnResizeEvent: isUserOriginated? true"); + + } + +} |