diff options
author | Denis Anisimov <denis@vaadin.com> | 2014-11-02 13:11:09 +0200 |
---|---|---|
committer | Sauli Tähkäpää <sauli@vaadin.com> | 2015-01-20 13:46:02 +0200 |
commit | 1951fe6e402e2440cfa0f2ac9937904daeed3e47 (patch) | |
tree | 2bea9f0b2f3df8c6fcc3739dbf0beda34ae3642f /server/tests/src/com | |
parent | 052a6999e98ee72ec2e56b544b5bb62db36e1e1d (diff) | |
download | vaadin-framework-1951fe6e402e2440cfa0f2ac9937904daeed3e47.tar.gz vaadin-framework-1951fe6e402e2440cfa0f2ac9937904daeed3e47.zip |
ICON_ONLY mode should not show icon row header for TreeTable (#14799).
Change-Id: If854186547e3d7b8e67710113ec6754bc84ace2f
Diffstat (limited to 'server/tests/src/com')
-rw-r--r-- | server/tests/src/com/vaadin/tests/server/component/treetable/TreeTableTest.java | 72 |
1 files changed, 72 insertions, 0 deletions
diff --git a/server/tests/src/com/vaadin/tests/server/component/treetable/TreeTableTest.java b/server/tests/src/com/vaadin/tests/server/component/treetable/TreeTableTest.java new file mode 100644 index 0000000000..60f4ac5f99 --- /dev/null +++ b/server/tests/src/com/vaadin/tests/server/component/treetable/TreeTableTest.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.server.component.treetable; + +import java.util.EnumSet; + +import org.junit.Assert; +import org.junit.Test; + +import com.vaadin.ui.Table.RowHeaderMode; +import com.vaadin.ui.TreeTable; + +/** + * Tests for {@link TreeTable} + * + * @author Vaadin Ltd + */ +public class TreeTableTest { + + @Test + public void rowHeadersAreEnabled_iconRowHeaderMode_rowHeadersAreDisabled() { + TestTreeTable tree = new TestTreeTable(); + tree.setRowHeaderMode(RowHeaderMode.ICON_ONLY); + + Assert.assertFalse("Row headers are enabled for Icon header mode", + tree.rowHeadersAreEnabled()); + } + + @Test + public void rowHeadersAreEnabled_hiddenRowHeaderMode_rowHeadersAreDisabled() { + TestTreeTable tree = new TestTreeTable(); + tree.setRowHeaderMode(RowHeaderMode.HIDDEN); + + Assert.assertFalse("Row headers are enabled for Hidden header mode", + tree.rowHeadersAreEnabled()); + } + + @Test + public void rowHeadersAreEnabled_otherRowHeaderModes_rowHeadersAreEnabled() { + TestTreeTable tree = new TestTreeTable(); + EnumSet<RowHeaderMode> modes = EnumSet.allOf(RowHeaderMode.class); + modes.remove(RowHeaderMode.ICON_ONLY); + modes.remove(RowHeaderMode.HIDDEN); + + for (RowHeaderMode mode : modes) { + tree.setRowHeaderMode(mode); + Assert.assertTrue("Row headers are disabled for " + mode + + " header mode", tree.rowHeadersAreEnabled()); + } + } + + private static class TestTreeTable extends TreeTable { + + @Override + protected boolean rowHeadersAreEnabled() { + return super.rowHeadersAreEnabled(); + } + } +} |