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.

CssLayoutDeclarativeTest.java 2.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  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.tests.server.component.csslayout;
  17. import org.junit.Test;
  18. import com.vaadin.shared.ui.ContentMode;
  19. import com.vaadin.tests.design.DeclarativeTestBase;
  20. import com.vaadin.ui.Button;
  21. import com.vaadin.ui.CssLayout;
  22. import com.vaadin.ui.Label;
  23. /**
  24. * Tests declarative support for CssLayout.
  25. *
  26. * @since
  27. * @author Vaadin Ltd
  28. */
  29. public class CssLayoutDeclarativeTest extends DeclarativeTestBase<CssLayout> {
  30. @Test
  31. public void testNoChildren() {
  32. String design = "<vaadin-css-layout />";
  33. CssLayout layout = new CssLayout();
  34. testRead(design, layout);
  35. testWrite(design, layout);
  36. design = "<vaadin-css-layout caption=\"A caption\"/>";
  37. layout = new CssLayout();
  38. layout.setCaption("A caption");
  39. testRead(design, layout);
  40. testWrite(design, layout);
  41. }
  42. @Test
  43. public void testFeatures() {
  44. String design = "<vaadin-css-layout caption=test-layout><vaadin-label caption=test-label />"
  45. + "<vaadin-button>test-button</vaadin-button></vaadin-css-layout>";
  46. CssLayout layout = new CssLayout();
  47. layout.setCaption("test-layout");
  48. Label l = new Label();
  49. l.setContentMode(ContentMode.HTML);
  50. l.setCaption("test-label");
  51. layout.addComponent(l);
  52. Button b = new Button("test-button");
  53. b.setCaptionAsHtml(true);
  54. layout.addComponent(b);
  55. testRead(design, layout);
  56. testWrite(design, layout);
  57. }
  58. }