diff options
author | Teemu Suo-Anttila <tsuoanttila@users.noreply.github.com> | 2017-08-01 11:41:39 +0300 |
---|---|---|
committer | Henri Sara <henri.sara@gmail.com> | 2017-08-01 11:41:39 +0300 |
commit | 7cf466fa7f0a1fbf48664a6c8211809f9932a997 (patch) | |
tree | 20b03e17583c38479481a09013e9a4db360b7991 /uitest | |
parent | 2af2783f502aac67ff01460b4bd00cd5a2e8a88c (diff) | |
download | vaadin-framework-7cf466fa7f0a1fbf48664a6c8211809f9932a997.tar.gz vaadin-framework-7cf466fa7f0a1fbf48664a6c8211809f9932a997.zip |
Add header and footer visibility setting to Grid (#9706)
Diffstat (limited to 'uitest')
-rw-r--r-- | uitest/src/main/java/com/vaadin/tests/components/grid/basics/GridBasics.java | 6 | ||||
-rw-r--r-- | uitest/src/test/java/com/vaadin/tests/components/grid/basics/GridHeaderFooterTest.java | 24 |
2 files changed, 30 insertions, 0 deletions
diff --git a/uitest/src/main/java/com/vaadin/tests/components/grid/basics/GridBasics.java b/uitest/src/main/java/com/vaadin/tests/components/grid/basics/GridBasics.java index 944f729efe..c5b6dbd490 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/grid/basics/GridBasics.java +++ b/uitest/src/main/java/com/vaadin/tests/components/grid/basics/GridBasics.java @@ -603,6 +603,9 @@ public class GridBasics extends AbstractTestUIWithLog { } private void createHeaderMenu(MenuItem headerMenu) { + headerMenu.addItem("Toggle header visibility", + menuitem -> grid.setHeaderVisible(!grid.isHeaderVisible())); + headerMenu.addItem("Append header row", menuItem -> { HeaderRow row = grid.appendHeaderRow(); @@ -662,6 +665,9 @@ public class GridBasics extends AbstractTestUIWithLog { } private void createFooterMenu(MenuItem footerMenu) { + footerMenu.addItem("Toggle footer visibility", + menuitem -> grid.setFooterVisible(!grid.isFooterVisible())); + footerMenu.addItem("Add default footer row", menuItem -> { FooterRow defaultFooter = grid.appendFooterRow(); grid.getColumns().forEach( diff --git a/uitest/src/test/java/com/vaadin/tests/components/grid/basics/GridHeaderFooterTest.java b/uitest/src/test/java/com/vaadin/tests/components/grid/basics/GridHeaderFooterTest.java index 45dba45954..b7ba76ea73 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/grid/basics/GridHeaderFooterTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/grid/basics/GridHeaderFooterTest.java @@ -380,6 +380,30 @@ public class GridHeaderFooterTest extends GridBasicsTest { } + @Test + public void testHideAndShowHeader() { + assertEquals("There should be one header row", 1, + getGridElement().getHeaderCount()); + selectMenuPath("Component", "Header", "Toggle header visibility"); + assertEquals("There should be no header rows", 0, + getGridElement().getHeaderCount()); + selectMenuPath("Component", "Header", "Toggle header visibility"); + assertEquals("There should be one header row again", 1, + getGridElement().getHeaderCount()); + } + + @Test + public void testHideAndShowFooter() { + assertEquals("There should be one footer row", 1, + getGridElement().getFooterCount()); + selectMenuPath("Component", "Footer", "Toggle footer visibility"); + assertEquals("There should be no footer rows", 0, + getGridElement().getFooterCount()); + selectMenuPath("Component", "Footer", "Toggle footer visibility"); + assertEquals("There should be one footer row again", 1, + getGridElement().getFooterCount()); + } + private void toggleColumnHidable(int index) { selectMenuPath("Component", "Columns", "Column " + index, "Hidable"); } |