Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

GridContextClickTest.java 2.4KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  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.contextclick;
  17. import static org.junit.Assert.assertEquals;
  18. import org.junit.Test;
  19. import com.vaadin.testbench.elements.GridElement;
  20. public class GridContextClickTest extends AbstractContextClickTest {
  21. @Test
  22. public void testBodyContextClickWithTypedListener() {
  23. addOrRemoveTypedListener();
  24. contextClick($(GridElement.class).first().getCell(0, 0));
  25. assertEquals(
  26. "1. ContextClickEvent value: Lisa Schneider, propertyId: address, section: BODY",
  27. getLogRow(0));
  28. contextClick($(GridElement.class).first().getCell(0, 3));
  29. assertEquals(
  30. "2. ContextClickEvent value: Lisa Schneider, propertyId: lastName, section: BODY",
  31. getLogRow(0));
  32. }
  33. @Test
  34. public void testHeaderContextClickWithTypedListener() {
  35. addOrRemoveTypedListener();
  36. contextClick($(GridElement.class).first().getHeaderCell(0, 0));
  37. assertEquals(
  38. "1. ContextClickEvent value: Address, propertyId: address, section: HEADER",
  39. getLogRow(0));
  40. contextClick($(GridElement.class).first().getHeaderCell(0, 3));
  41. assertEquals(
  42. "2. ContextClickEvent value: Last Name, propertyId: lastName, section: HEADER",
  43. getLogRow(0));
  44. }
  45. @Test
  46. public void testFooterContextClickWithTypedListener() {
  47. addOrRemoveTypedListener();
  48. contextClick($(GridElement.class).first().getFooterCell(0, 0));
  49. assertEquals(
  50. "1. ContextClickEvent value: , propertyId: address, section: FOOTER",
  51. getLogRow(0));
  52. contextClick($(GridElement.class).first().getFooterCell(0, 3));
  53. assertEquals(
  54. "2. ContextClickEvent value: , propertyId: lastName, section: FOOTER",
  55. getLogRow(0));
  56. }
  57. }