diff options
author | Denis Anisimov <denis@vaadin.com> | 2015-09-24 11:53:58 +0300 |
---|---|---|
committer | Denis Anisimov <denis@vaadin.com> | 2015-10-16 09:58:35 +0300 |
commit | bf030a07b0614c9782dd02669900529175069c15 (patch) | |
tree | 7609ceaac9d81f8994e7fa32f6d263a1e654f7b6 /server/tests/src | |
parent | 5b4906440b4113674b5c7cd88be68c0581bc564e (diff) | |
download | vaadin-framework-bf030a07b0614c9782dd02669900529175069c15.tar.gz vaadin-framework-bf030a07b0614c9782dd02669900529175069c15.zip |
Provide own states for a number of components (#18987).
Change-Id: I9fe4a332bb8170a6482610d1b83bad73e049a3a1
Diffstat (limited to 'server/tests/src')
14 files changed, 646 insertions, 0 deletions
diff --git a/server/tests/src/com/vaadin/tests/server/component/abstractselect/AbstractSelectStateTest.java b/server/tests/src/com/vaadin/tests/server/component/abstractselect/AbstractSelectStateTest.java new file mode 100644 index 0000000000..52b215f4c8 --- /dev/null +++ b/server/tests/src/com/vaadin/tests/server/component/abstractselect/AbstractSelectStateTest.java @@ -0,0 +1,60 @@ +/* + * 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.abstractselect; + +import org.junit.Assert; +import org.junit.Test; + +import com.vaadin.shared.ui.select.AbstractSelectState; +import com.vaadin.ui.AbstractSelect; + +/** + * Tests for AbstractSelect state + * + */ +public class AbstractSelectStateTest { + + @Test + public void getState_selectHasCustomState() { + TestSelect select = new TestSelect(); + AbstractSelectState state = select.getState(); + Assert.assertEquals("Unexpected state class", + AbstractSelectState.class, state.getClass()); + } + + @Test + public void getPrimaryStyleName_selectHasCustomPrimaryStyleName() { + TestSelect combobox = new TestSelect(); + AbstractSelectState state = new AbstractSelectState(); + Assert.assertEquals("Unexpected primary style name", + state.primaryStyleName, combobox.getPrimaryStyleName()); + } + + @Test + public void selectStateHasCustomPrimaryStyleName() { + AbstractSelectState state = new AbstractSelectState(); + Assert.assertEquals("Unexpected primary style name", "v-select", + state.primaryStyleName); + } + + private static class TestSelect extends AbstractSelect { + + @Override + public AbstractSelectState getState() { + return super.getState(); + } + } +} diff --git a/server/tests/src/com/vaadin/tests/server/component/audio/AudioStateTest.java b/server/tests/src/com/vaadin/tests/server/component/audio/AudioStateTest.java new file mode 100644 index 0000000000..d18127791e --- /dev/null +++ b/server/tests/src/com/vaadin/tests/server/component/audio/AudioStateTest.java @@ -0,0 +1,59 @@ +/* + * 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.audio; + +import org.junit.Assert; +import org.junit.Test; + +import com.vaadin.shared.ui.audio.AudioState; +import com.vaadin.ui.Audio; + +/** + * Tests for Audio state. + * + */ +public class AudioStateTest { + @Test + public void getState_audioHasCustomState() { + TestAudio audio = new TestAudio(); + AudioState state = audio.getState(); + Assert.assertEquals("Unexpected state class", AudioState.class, + state.getClass()); + } + + @Test + public void getPrimaryStyleName_audioHasCustomPrimaryStyleName() { + Audio audio = new Audio(); + AudioState state = new AudioState(); + Assert.assertEquals("Unexpected primary style name", + state.primaryStyleName, audio.getPrimaryStyleName()); + } + + @Test + public void audioStateHasCustomPrimaryStyleName() { + AudioState state = new AudioState(); + Assert.assertEquals("Unexpected primary style name", "v-audio", + state.primaryStyleName); + } + + private static class TestAudio extends Audio { + + @Override + public AudioState getState() { + return super.getState(); + } + } +} diff --git a/server/tests/src/com/vaadin/tests/server/component/combobox/ComboBoxStateTest.java b/server/tests/src/com/vaadin/tests/server/component/combobox/ComboBoxStateTest.java new file mode 100644 index 0000000000..0908a355de --- /dev/null +++ b/server/tests/src/com/vaadin/tests/server/component/combobox/ComboBoxStateTest.java @@ -0,0 +1,59 @@ +/* + * 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.combobox; + +import org.junit.Assert; +import org.junit.Test; + +import com.vaadin.shared.ui.combobox.ComboBoxState; +import com.vaadin.ui.ComboBox; + +/** + * Tests for ComboBox state. + * + */ +public class ComboBoxStateTest { + @Test + public void getState_comboboxHasCustomState() { + TestComboBox combobox = new TestComboBox(); + ComboBoxState state = combobox.getState(); + Assert.assertEquals("Unexpected state class", ComboBoxState.class, + state.getClass()); + } + + @Test + public void getPrimaryStyleName_comboboxHasCustomPrimaryStyleName() { + ComboBox combobox = new ComboBox(); + ComboBoxState state = new ComboBoxState(); + Assert.assertEquals("Unexpected primary style name", + state.primaryStyleName, combobox.getPrimaryStyleName()); + } + + @Test + public void comboboxStateHasCustomPrimaryStyleName() { + ComboBoxState state = new ComboBoxState(); + Assert.assertEquals("Unexpected primary style name", "v-filterselect", + state.primaryStyleName); + } + + private static class TestComboBox extends ComboBox { + + @Override + public ComboBoxState getState() { + return super.getState(); + } + } +} diff --git a/server/tests/src/com/vaadin/tests/server/component/grid/GridStateTest.java b/server/tests/src/com/vaadin/tests/server/component/grid/GridStateTest.java new file mode 100644 index 0000000000..567fad52af --- /dev/null +++ b/server/tests/src/com/vaadin/tests/server/component/grid/GridStateTest.java @@ -0,0 +1,44 @@ +/* + * 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.grid; + +import org.junit.Assert; +import org.junit.Test; + +import com.vaadin.shared.ui.grid.GridState; +import com.vaadin.ui.Grid; + +/** + * Tests for Grid State. + * + */ +public class GridStateTest { + + @Test + public void getPrimaryStyleName_gridHasCustomPrimaryStyleName() { + Grid grid = new Grid(); + GridState state = new GridState(); + Assert.assertEquals("Unexpected primary style name", + state.primaryStyleName, grid.getPrimaryStyleName()); + } + + @Test + public void gridStateHasCustomPrimaryStyleName() { + GridState state = new GridState(); + Assert.assertEquals("Unexpected primary style name", "v-grid", + state.primaryStyleName); + } +} diff --git a/server/tests/src/com/vaadin/tests/server/component/listselect/ListSelectStateTest.java b/server/tests/src/com/vaadin/tests/server/component/listselect/ListSelectStateTest.java new file mode 100644 index 0000000000..01dc71d96a --- /dev/null +++ b/server/tests/src/com/vaadin/tests/server/component/listselect/ListSelectStateTest.java @@ -0,0 +1,45 @@ +/* + * 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.listselect; + +import org.junit.Assert; +import org.junit.Test; + +import com.vaadin.shared.ui.select.AbstractSelectState; +import com.vaadin.ui.ListSelect; + +/** + * Tests for ListSelect State. + * + */ +public class ListSelectStateTest { + + @Test + public void getState_listSelectHasCustomState() { + TestListSelect select = new TestListSelect(); + AbstractSelectState state = select.getState(); + Assert.assertEquals("Unexpected state class", + AbstractSelectState.class, state.getClass()); + } + + private static class TestListSelect extends ListSelect { + @Override + public AbstractSelectState getState() { + return super.getState(); + } + } + +} diff --git a/server/tests/src/com/vaadin/tests/server/component/optiongroup/OptionGroupStateTest.java b/server/tests/src/com/vaadin/tests/server/component/optiongroup/OptionGroupStateTest.java new file mode 100644 index 0000000000..59ff432cad --- /dev/null +++ b/server/tests/src/com/vaadin/tests/server/component/optiongroup/OptionGroupStateTest.java @@ -0,0 +1,60 @@ +/* + * 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.optiongroup; + +import org.junit.Assert; +import org.junit.Test; + +import com.vaadin.shared.ui.optiongroup.OptionGroupState; +import com.vaadin.ui.OptionGroup; + +/** + * Tests for OptionGroup state. + * + */ +public class OptionGroupStateTest { + + @Test + public void getState_optionGroupHasCustomState() { + TestOptionGroup group = new TestOptionGroup(); + OptionGroupState state = group.getState(); + Assert.assertEquals("Unexpected state class", OptionGroupState.class, + state.getClass()); + } + + @Test + public void getPrimaryStyleName_optionGroupHasCustomPrimaryStyleName() { + OptionGroup layout = new OptionGroup(); + OptionGroupState state = new OptionGroupState(); + Assert.assertEquals("Unexpected primary style name", + state.primaryStyleName, layout.getPrimaryStyleName()); + } + + @Test + public void optionGroupStateHasCustomPrimaryStyleName() { + OptionGroupState state = new OptionGroupState(); + Assert.assertEquals("Unexpected primary style name", + "v-select-optiongroup", state.primaryStyleName); + } + + private static class TestOptionGroup extends OptionGroup { + + @Override + public OptionGroupState getState() { + return super.getState(); + } + } +} diff --git a/server/tests/src/com/vaadin/tests/server/component/richtextarea/RichTextAreaStateTest.java b/server/tests/src/com/vaadin/tests/server/component/richtextarea/RichTextAreaStateTest.java new file mode 100644 index 0000000000..d1c0f8fa1e --- /dev/null +++ b/server/tests/src/com/vaadin/tests/server/component/richtextarea/RichTextAreaStateTest.java @@ -0,0 +1,59 @@ +/* + * 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.richtextarea; + +import org.junit.Assert; +import org.junit.Test; + +import com.vaadin.shared.ui.textarea.RichTextAreaState; +import com.vaadin.ui.RichTextArea; + +/** + * Tests for RichTextArea State. + * + */ +public class RichTextAreaStateTest { + @Test + public void getState_areaHasCustomState() { + TestRichTextArea area = new TestRichTextArea(); + RichTextAreaState state = area.getState(); + Assert.assertEquals("Unexpected state class", RichTextAreaState.class, + state.getClass()); + } + + @Test + public void getPrimaryStyleName_areaHasCustomPrimaryStyleName() { + RichTextArea area = new RichTextArea(); + RichTextAreaState state = new RichTextAreaState(); + Assert.assertEquals("Unexpected primary style name", + state.primaryStyleName, area.getPrimaryStyleName()); + } + + @Test + public void areaStateHasCustomPrimaryStyleName() { + RichTextAreaState state = new RichTextAreaState(); + Assert.assertEquals("Unexpected primary style name", "v-richtextarea", + state.primaryStyleName); + } + + private static class TestRichTextArea extends RichTextArea { + + @Override + public RichTextAreaState getState() { + return super.getState(); + } + } +} diff --git a/server/tests/src/com/vaadin/tests/server/component/table/TableStateTest.java b/server/tests/src/com/vaadin/tests/server/component/table/TableStateTest.java new file mode 100644 index 0000000000..7f951e0835 --- /dev/null +++ b/server/tests/src/com/vaadin/tests/server/component/table/TableStateTest.java @@ -0,0 +1,60 @@ +/* + * 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.table; + +import org.junit.Assert; +import org.junit.Test; + +import com.vaadin.shared.ui.table.TableState; +import com.vaadin.ui.Table; + +/** + * Tests for Table State. + * + */ +public class TableStateTest { + + @Test + public void getState_tableHasCustomState() { + TestTable table = new TestTable(); + TableState state = table.getState(); + Assert.assertEquals("Unexpected state class", TableState.class, + state.getClass()); + } + + @Test + public void getPrimaryStyleName_tableHasCustomPrimaryStyleName() { + Table table = new Table(); + TableState state = new TableState(); + Assert.assertEquals("Unexpected primary style name", + state.primaryStyleName, table.getPrimaryStyleName()); + } + + @Test + public void tableStateHasCustomPrimaryStyleName() { + TableState state = new TableState(); + Assert.assertEquals("Unexpected primary style name", "v-table", + state.primaryStyleName); + } + + private static class TestTable extends Table { + + @Override + public TableState getState() { + return super.getState(); + } + } +} diff --git a/server/tests/src/com/vaadin/tests/server/component/tree/TreeTest.java b/server/tests/src/com/vaadin/tests/server/component/tree/TreeTest.java index 3c9fc4c0cd..3e5425a875 100644 --- a/server/tests/src/com/vaadin/tests/server/component/tree/TreeTest.java +++ b/server/tests/src/com/vaadin/tests/server/component/tree/TreeTest.java @@ -8,12 +8,14 @@ import static org.junit.Assert.assertTrue; import java.lang.reflect.Field; import java.util.HashSet; +import org.junit.Assert; import org.junit.Before; import org.junit.Test; import com.vaadin.data.Container; import com.vaadin.data.util.HierarchicalContainer; import com.vaadin.data.util.IndexedContainer; +import com.vaadin.shared.ui.tree.TreeState; import com.vaadin.ui.Tree; public class TreeTest { @@ -142,4 +144,35 @@ public class TreeTest { assertNull(expandedItemId); } + @Test + public void getState_treeHasCustomState() { + TestTree table = new TestTree(); + TreeState state = table.getState(); + Assert.assertEquals("Unexpected state class", TreeState.class, + state.getClass()); + } + + @Test + public void getPrimaryStyleName_treeHasCustomPrimaryStyleName() { + Tree table = new Tree(); + TreeState state = new TreeState(); + Assert.assertEquals("Unexpected primary style name", + state.primaryStyleName, table.getPrimaryStyleName()); + } + + @Test + public void treeStateHasCustomPrimaryStyleName() { + TreeState state = new TreeState(); + Assert.assertEquals("Unexpected primary style name", "v-tree", + state.primaryStyleName); + } + + private static class TestTree extends Tree { + + @Override + public TreeState getState() { + return super.getState(); + } + } + } 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 index 60f4ac5f99..33f41d84ea 100644 --- a/server/tests/src/com/vaadin/tests/server/component/treetable/TreeTableTest.java +++ b/server/tests/src/com/vaadin/tests/server/component/treetable/TreeTableTest.java @@ -20,6 +20,7 @@ import java.util.EnumSet; import org.junit.Assert; import org.junit.Test; +import com.vaadin.shared.ui.treetable.TreeTableState; import com.vaadin.ui.Table.RowHeaderMode; import com.vaadin.ui.TreeTable; @@ -62,11 +63,39 @@ public class TreeTableTest { } } + @Test + public void getState_treeTableHasCustomState() { + TestTreeTable table = new TestTreeTable(); + TreeTableState state = table.getState(); + Assert.assertEquals("Unexpected state class", TreeTableState.class, + state.getClass()); + } + + @Test + public void getPrimaryStyleName_treeTableHasCustomPrimaryStyleName() { + TreeTable table = new TreeTable(); + TreeTableState state = new TreeTableState(); + Assert.assertEquals("Unexpected primary style name", + state.primaryStyleName, table.getPrimaryStyleName()); + } + + @Test + public void treeTableStateHasCustomPrimaryStyleName() { + TreeTableState state = new TreeTableState(); + Assert.assertEquals("Unexpected primary style name", "v-table", + state.primaryStyleName); + } + private static class TestTreeTable extends TreeTable { @Override protected boolean rowHeadersAreEnabled() { return super.rowHeadersAreEnabled(); } + + @Override + public TreeTableState getState() { + return super.getState(); + } } } diff --git a/server/tests/src/com/vaadin/tests/server/component/twincolselect/TwinColSelectStateTest.java b/server/tests/src/com/vaadin/tests/server/component/twincolselect/TwinColSelectStateTest.java new file mode 100644 index 0000000000..b2e2c0a65b --- /dev/null +++ b/server/tests/src/com/vaadin/tests/server/component/twincolselect/TwinColSelectStateTest.java @@ -0,0 +1,60 @@ +/* + * 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.twincolselect; + +import org.junit.Assert; +import org.junit.Test; + +import com.vaadin.shared.ui.twincolselect.TwinColSelectState; +import com.vaadin.ui.TwinColSelect; + +/** + * Tests for TwinColSelectState. + * + */ +public class TwinColSelectStateTest { + + @Test + public void getState_selectHasCustomState() { + TestTwinColSelect select = new TestTwinColSelect(); + TwinColSelectState state = select.getState(); + Assert.assertEquals("Unexpected state class", TwinColSelectState.class, + state.getClass()); + } + + @Test + public void getPrimaryStyleName_selectHasCustomPrimaryStyleName() { + TwinColSelect table = new TwinColSelect(); + TwinColSelectState state = new TwinColSelectState(); + Assert.assertEquals("Unexpected primary style name", + state.primaryStyleName, table.getPrimaryStyleName()); + } + + @Test + public void selectStateHasCustomPrimaryStyleName() { + TwinColSelectState state = new TwinColSelectState(); + Assert.assertEquals("Unexpected primary style name", + "v-select-twincol", state.primaryStyleName); + } + + private static class TestTwinColSelect extends TwinColSelect { + + @Override + public TwinColSelectState getState() { + return super.getState(); + } + } +} diff --git a/server/tests/src/com/vaadin/tests/server/component/upload/UploadTest.java b/server/tests/src/com/vaadin/tests/server/component/upload/UploadTest.java index 2132829c0a..358e4db9cd 100644 --- a/server/tests/src/com/vaadin/tests/server/component/upload/UploadTest.java +++ b/server/tests/src/com/vaadin/tests/server/component/upload/UploadTest.java @@ -20,6 +20,7 @@ import org.junit.Test; import com.vaadin.server.StreamVariable; import com.vaadin.server.StreamVariable.StreamingErrorEvent; +import com.vaadin.shared.ui.upload.UploadState; import com.vaadin.ui.Upload; /** @@ -40,6 +41,29 @@ public class UploadTest { Assert.assertFalse(upload.isUploading()); } + @Test + public void getState_uploadHasCustomState() { + TestUpload upload = new TestUpload(); + UploadState state = upload.getState(); + Assert.assertEquals("Unexpected state class", UploadState.class, + state.getClass()); + } + + @Test + public void getPrimaryStyleName_uploadHasCustomPrimaryStyleName() { + Upload upload = new Upload(); + UploadState state = new UploadState(); + Assert.assertEquals("Unexpected primary style name", + state.primaryStyleName, upload.getPrimaryStyleName()); + } + + @Test + public void uploadStateHasCustomPrimaryStyleName() { + UploadState state = new UploadState(); + Assert.assertEquals("Unexpected primary style name", "v-upload", + state.primaryStyleName); + } + private static class TestStreamingErrorEvent implements StreamingErrorEvent { @Override @@ -77,6 +101,11 @@ public class UploadTest { } @Override + public UploadState getState() { + return super.getState(); + } + + @Override protected void fireNoInputStream(String filename, String MIMEType, long length) { fireEvent(); diff --git a/server/tests/src/com/vaadin/tests/server/componentcontainer/FormLayoutTest.java b/server/tests/src/com/vaadin/tests/server/componentcontainer/FormLayoutTest.java index c689e7fe06..f55798007f 100644 --- a/server/tests/src/com/vaadin/tests/server/componentcontainer/FormLayoutTest.java +++ b/server/tests/src/com/vaadin/tests/server/componentcontainer/FormLayoutTest.java @@ -3,8 +3,10 @@ package com.vaadin.tests.server.componentcontainer; import java.util.Iterator; import java.util.NoSuchElementException; +import org.junit.Assert; import org.junit.Test; +import com.vaadin.shared.ui.orderedlayout.FormLayoutState; import com.vaadin.ui.Component; import com.vaadin.ui.FormLayout; import com.vaadin.ui.Label; @@ -53,6 +55,29 @@ public class FormLayoutTest extends AbstractIndexedLayoutTestBase { assertOrder(l, new int[] { 0, 1, 2, 3 }); } + @Test + public void getState_formLayoutHasCustomState() { + TestFormLayout layout = new TestFormLayout(); + FormLayoutState state = layout.getState(); + Assert.assertEquals("Unexpected state class", FormLayoutState.class, + state.getClass()); + } + + @Test + public void getPrimaryStyleName_formLayoutHasCustomPrimaryStyleName() { + FormLayout layout = new FormLayout(); + FormLayoutState state = new FormLayoutState(); + Assert.assertEquals("Unexpected primary style name", + state.primaryStyleName, layout.getPrimaryStyleName()); + } + + @Test + public void formLayoutStateHasCustomPrimaryStyleName() { + FormLayoutState state = new FormLayoutState(); + Assert.assertEquals("Unexpected primary style name", "v-formlayout", + state.primaryStyleName); + } + private void assertOrder(Layout layout, int[] indices) { Iterator<?> i = layout.iterator(); try { @@ -69,4 +94,12 @@ public class FormLayoutTest extends AbstractIndexedLayoutTestBase { } } + private static class TestFormLayout extends FormLayout { + + @Override + public FormLayoutState getState() { + return super.getState(); + } + } + } diff --git a/server/tests/src/com/vaadin/ui/NativeSelectTest.java b/server/tests/src/com/vaadin/ui/NativeSelectTest.java index 7e2a04ef1c..78e4715f9b 100644 --- a/server/tests/src/com/vaadin/ui/NativeSelectTest.java +++ b/server/tests/src/com/vaadin/ui/NativeSelectTest.java @@ -21,6 +21,7 @@ import org.junit.Assert; import org.junit.Test; import com.vaadin.data.util.IndexedContainer; +import com.vaadin.shared.ui.select.AbstractSelectState; public class NativeSelectTest { @@ -45,6 +46,21 @@ public class NativeSelectTest { assertFocusRpcRegistered(new NativeSelect("foo", new IndexedContainer())); } + @Test + public void getState_listSelectHasCustomState() { + TestNativeSelect select = new TestNativeSelect(); + AbstractSelectState state = select.getState(); + Assert.assertEquals("Unexpected state class", + AbstractSelectState.class, state.getClass()); + } + + private static class TestNativeSelect extends NativeSelect { + @Override + public AbstractSelectState getState() { + return super.getState(); + } + } + private void assertFocusRpcRegistered(NativeSelect s) { Assert.assertNotNull( "RPC is not correctly registered", |