aboutsummaryrefslogtreecommitdiffstats
path: root/uitest/src/com/vaadin/tests/components
diff options
context:
space:
mode:
authorPekka Hyvönen <pekka@vaadin.com>2015-03-24 15:19:35 +0200
committerHenrik Paul <henrik@vaadin.com>2015-03-25 14:18:00 +0000
commitda95f395add4916d0544858c87b448ddc5d03881 (patch)
tree5afeb45cf29858a811e64db48778b89791e18864 /uitest/src/com/vaadin/tests/components
parentdd2c4c9e7b6f1b4f0a930cfd5c5e24e536b7e7b6 (diff)
downloadvaadin-framework-da95f395add4916d0544858c87b448ddc5d03881.tar.gz
vaadin-framework-da95f395add4916d0544858c87b448ddc5d03881.zip
Fix Grid's frozen column count with hidden columns #17273
Change-Id: I4f8a893eec3cf7c32da34cb364a4d56589cbf3e2
Diffstat (limited to 'uitest/src/com/vaadin/tests/components')
-rw-r--r--uitest/src/com/vaadin/tests/components/grid/basicfeatures/GridColumnHidingTest.java75
-rw-r--r--uitest/src/com/vaadin/tests/components/grid/basicfeatures/server/GridColumnVisibilityTest.java69
2 files changed, 144 insertions, 0 deletions
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 aca7689a0a..c12c769c63 100644
--- a/uitest/src/com/vaadin/tests/components/grid/basicfeatures/GridColumnHidingTest.java
+++ b/uitest/src/com/vaadin/tests/components/grid/basicfeatures/GridColumnHidingTest.java
@@ -556,6 +556,81 @@ public class GridColumnHidingTest extends GridBasicClientFeaturesTest {
assertTrue(cell.isFocused());
}
+ @Test
+ public void testFrozenColumnHiding_lastFrozenColumnHidden_isFrozenWhenMadeVisible() {
+ toggleFrozenColumns(2);
+ toggleHidableColumnAPI(0);
+ toggleHidableColumnAPI(1);
+ getSidebarOpenButton().click();
+ verifyColumnIsFrozen(0);
+ verifyColumnIsFrozen(1);
+ verifyColumnIsNotFrozen(2);
+ assertColumnHeaderOrder(0, 1, 2, 3);
+
+ getColumnHidingToggle(1).click();
+ verifyColumnIsFrozen(0);
+ // the grid element indexing doesn't take hidden columns into account!
+ verifyColumnIsNotFrozen(1);
+ assertColumnHeaderOrder(0, 2, 3);
+
+ getColumnHidingToggle(0).click();
+ verifyColumnIsNotFrozen(0);
+ assertColumnHeaderOrder(2, 3, 4);
+
+ getColumnHidingToggle(0).click();
+ assertColumnHeaderOrder(0, 2, 3);
+ verifyColumnIsFrozen(0);
+ verifyColumnIsNotFrozen(1);
+
+ getColumnHidingToggle(1).click();
+ assertColumnHeaderOrder(0, 1, 2, 3);
+ verifyColumnIsFrozen(0);
+ verifyColumnIsFrozen(1);
+ verifyColumnIsNotFrozen(2);
+ }
+
+ @Test
+ public void testFrozenColumnHiding_columnHiddenFrozenCountChanged_columnIsFrozenWhenVisible() {
+ toggleHidableColumnAPI(1);
+ toggleHidableColumnAPI(2);
+ getSidebarOpenButton().click();
+ getColumnHidingToggle(1).click();
+ getColumnHidingToggle(2).click();
+ assertColumnHeaderOrder(0, 3, 4);
+
+ toggleFrozenColumns(3);
+ verifyColumnIsFrozen(0);
+ // the grid element indexing doesn't take hidden columns into account!
+ verifyColumnIsNotFrozen(1);
+ verifyColumnIsNotFrozen(2);
+
+ getColumnHidingToggle(2).click();
+ verifyColumnIsFrozen(0);
+ verifyColumnIsFrozen(1);
+ verifyColumnIsNotFrozen(2);
+ verifyColumnIsNotFrozen(3);
+
+ getColumnHidingToggle(1).click();
+ verifyColumnIsFrozen(0);
+ verifyColumnIsFrozen(1);
+ verifyColumnIsFrozen(2);
+ verifyColumnIsNotFrozen(3);
+ verifyColumnIsNotFrozen(4);
+ }
+
+ private void toggleFrozenColumns(int count) {
+ selectMenuPath("Component", "State", "Frozen column count", count
+ + " columns");
+ }
+
+ private void verifyColumnIsFrozen(int index) {
+ assertTrue(getGridElement().getHeaderCell(0, index).isFrozen());
+ }
+
+ private void verifyColumnIsNotFrozen(int index) {
+ assertFalse(getGridElement().getHeaderCell(0, index).isFrozen());
+ }
+
private void verifyColumnHidingTogglesOrder(int... indices) {
WebElement sidebar = getSidebar();
List<WebElement> elements = sidebar.findElements(By
diff --git a/uitest/src/com/vaadin/tests/components/grid/basicfeatures/server/GridColumnVisibilityTest.java b/uitest/src/com/vaadin/tests/components/grid/basicfeatures/server/GridColumnVisibilityTest.java
index 22a08d6748..37eda1c28f 100644
--- a/uitest/src/com/vaadin/tests/components/grid/basicfeatures/server/GridColumnVisibilityTest.java
+++ b/uitest/src/com/vaadin/tests/components/grid/basicfeatures/server/GridColumnVisibilityTest.java
@@ -166,6 +166,75 @@ public class GridColumnVisibilityTest extends GridBasicFeaturesTest {
assertNotNull(getColumnHidingToggle(0));
}
+ @Test
+ public void testFrozenColumnHiding_hiddenColumnMadeFrozen_frozenWhenMadeVisible() {
+ selectMenuPath("Component", "Size", "Width", "100%");
+ toggleColumnHidable(0);
+ toggleColumnHidable(1);
+ getSidebarOpenButton().click();
+ getColumnHidingToggle(0).click();
+ getColumnHidingToggle(1).click();
+
+ assertColumnHeaderOrder(2, 3, 4, 5);
+
+ setFrozenColumns(2);
+ verifyColumnNotFrozen(0);
+ verifyColumnNotFrozen(1);
+
+ getColumnHidingToggle(0).click();
+ assertColumnHeaderOrder(0, 2, 3, 4, 5);
+ verifyColumnFrozen(0);
+ verifyColumnNotFrozen(1);
+
+ getColumnHidingToggle(1).click();
+ assertColumnHeaderOrder(0, 1, 2, 3, 4, 5);
+ verifyColumnFrozen(0);
+ verifyColumnFrozen(1);
+ verifyColumnNotFrozen(2);
+ }
+
+ @Test
+ public void testFrozenColumnHiding_hiddenFrozenColumnUnfrozen_notFrozenWhenMadeVisible() {
+ selectMenuPath("Component", "Size", "Width", "100%");
+ toggleColumnHidable(0);
+ toggleColumnHidable(1);
+ setFrozenColumns(2);
+ verifyColumnFrozen(0);
+ verifyColumnFrozen(1);
+ verifyColumnNotFrozen(2);
+ verifyColumnNotFrozen(3);
+
+ getSidebarOpenButton().click();
+ getColumnHidingToggle(0).click();
+ getColumnHidingToggle(1).click();
+ assertColumnHeaderOrder(2, 3, 4, 5);
+ verifyColumnNotFrozen(0);
+ verifyColumnNotFrozen(1);
+
+ setFrozenColumns(0);
+ verifyColumnNotFrozen(0);
+ verifyColumnNotFrozen(1);
+
+ getColumnHidingToggle(0).click();
+ assertColumnHeaderOrder(0, 2, 3, 4, 5);
+ verifyColumnNotFrozen(0);
+ verifyColumnNotFrozen(1);
+
+ getColumnHidingToggle(1).click();
+ assertColumnHeaderOrder(0, 1, 2, 3, 4, 5);
+ verifyColumnNotFrozen(0);
+ verifyColumnNotFrozen(1);
+ verifyColumnNotFrozen(2);
+ }
+
+ private void verifyColumnFrozen(int index) {
+ assertTrue(getGridElement().getHeaderCell(0, index).isFrozen());
+ }
+
+ private void verifyColumnNotFrozen(int index) {
+ assertFalse(getGridElement().getHeaderCell(0, index).isFrozen());
+ }
+
private void toggleColumnHidable(int index) {
selectMenuPath("Component", "Columns", "Column " + index, "Hidable");
}