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.

GridDefaultTextRendererTest.java 2.2KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. /*
  2. * Copyright 2000-2014 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.components.grid.basicfeatures;
  17. import static org.junit.Assert.assertEquals;
  18. import static org.junit.Assert.assertFalse;
  19. import static org.junit.Assert.assertTrue;
  20. import org.junit.Before;
  21. import org.junit.Test;
  22. import com.vaadin.testbench.By;
  23. import com.vaadin.testbench.elements.GridElement;
  24. import com.vaadin.testbench.elements.NotificationElement;
  25. import com.vaadin.testbench.elementsbase.ServerClass;
  26. import com.vaadin.testbench.parallel.TestCategory;
  27. import com.vaadin.tests.tb3.MultiBrowserTest;
  28. @TestCategory("grid")
  29. public class GridDefaultTextRendererTest extends MultiBrowserTest {
  30. @ServerClass("com.vaadin.tests.widgetset.server.TestWidgetComponent")
  31. public static class MyGridElement extends GridElement {
  32. // empty
  33. }
  34. private GridElement grid;
  35. @Before
  36. public void init() {
  37. setDebug(true);
  38. openTestURL();
  39. grid = $(MyGridElement.class).first();
  40. assertFalse("There was an unexpected notification during init",
  41. $(NotificationElement.class).exists());
  42. }
  43. @Test
  44. public void testNullIsRenderedAsEmptyStringByDefaultTextRenderer() {
  45. assertTrue("First cell should've been empty", grid.getCell(0, 0)
  46. .getText().isEmpty());
  47. }
  48. @Test
  49. public void testStringIsRenderedAsStringByDefaultTextRenderer() {
  50. assertEquals("Second cell should've been populated ", "string", grid
  51. .getCell(1, 0).getText());
  52. }
  53. @Test
  54. public void testWarningShouldNotBeInDebugLog() {
  55. assertFalse("Warning visible with string content.",
  56. isElementPresent(By.xpath("//span[contains(.,'attached:#1')]")));
  57. }
  58. }