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.

ListSelectDeclarativeTest.java 1.4KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. package com.vaadin.v7.tests.server.component.listselect;
  2. import org.junit.Test;
  3. import com.vaadin.tests.design.DeclarativeTestBase;
  4. import com.vaadin.v7.ui.ListSelect;
  5. public class ListSelectDeclarativeTest extends DeclarativeTestBase<ListSelect> {
  6. private ListSelect getWithOptionsExpected() {
  7. ListSelect ls = new ListSelect();
  8. ls.setRows(10);
  9. ls.addItem("Male");
  10. ls.addItem("Female");
  11. return ls;
  12. }
  13. private String getWithOptionsDesign() {
  14. return "<vaadin7-list-select rows=10>\n"
  15. + " <option>Male</option>\n"
  16. + " <option>Female</option>\n"
  17. + "</vaadin7-list-select>\n" + "";
  18. }
  19. @Test
  20. public void testReadWithOptions() {
  21. testRead(getWithOptionsDesign(), getWithOptionsExpected());
  22. }
  23. @Test
  24. public void testWriteWithOptions() {
  25. testWrite(stripOptionTags(getWithOptionsDesign()),
  26. getWithOptionsExpected());
  27. }
  28. private ListSelect getBasicExpected() {
  29. ListSelect ls = new ListSelect();
  30. ls.setCaption("Hello");
  31. return ls;
  32. }
  33. private String getBasicDesign() {
  34. return "<vaadin7-list-select caption='Hello' />";
  35. }
  36. @Test
  37. public void testReadBasic() {
  38. testRead(getBasicDesign(), getBasicExpected());
  39. }
  40. @Test
  41. public void testWriteBasic() {
  42. testWrite(getBasicDesign(), getBasicExpected());
  43. }
  44. }