You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

AbstractSelectStateTest.java 1.9KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. /*
  2. * Copyright 2000-2016 Vaadin Ltd.
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License"); you may not
  5. * use this file except in compliance with the License. You may obtain a copy of
  6. * the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
  12. * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
  13. * License for the specific language governing permissions and limitations under
  14. * the License.
  15. */
  16. package com.vaadin.v7.tests.server.component.abstractselect;
  17. import static org.junit.Assert.assertEquals;
  18. import org.junit.Test;
  19. import com.vaadin.v7.shared.ui.select.AbstractSelectState;
  20. import com.vaadin.v7.ui.AbstractSelect;
  21. /**
  22. * Tests for AbstractSelect state
  23. *
  24. */
  25. public class AbstractSelectStateTest {
  26. @Test
  27. public void getState_selectHasCustomState() {
  28. TestSelect select = new TestSelect();
  29. AbstractSelectState state = select.getState();
  30. assertEquals("Unexpected state class", AbstractSelectState.class,
  31. state.getClass());
  32. }
  33. @Test
  34. public void getPrimaryStyleName_selectHasCustomPrimaryStyleName() {
  35. TestSelect combobox = new TestSelect();
  36. AbstractSelectState state = new AbstractSelectState();
  37. assertEquals("Unexpected primary style name", state.primaryStyleName,
  38. combobox.getPrimaryStyleName());
  39. }
  40. @Test
  41. public void selectStateHasCustomPrimaryStyleName() {
  42. AbstractSelectState state = new AbstractSelectState();
  43. assertEquals("Unexpected primary style name", "v-select",
  44. state.primaryStyleName);
  45. }
  46. private static class TestSelect extends AbstractSelect {
  47. @Override
  48. public AbstractSelectState getState() {
  49. return super.getState();
  50. }
  51. }
  52. }