Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

DateTimeFieldKeyboardInputTest.java 1.6KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  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.components.datefield;
  17. import static org.junit.Assert.assertTrue;
  18. import org.junit.Test;
  19. import org.openqa.selenium.By;
  20. import org.openqa.selenium.Keys;
  21. import org.openqa.selenium.WebElement;
  22. import com.vaadin.testbench.customelements.DateTimeFieldElement;
  23. import com.vaadin.testbench.elements.LabelElement;
  24. import com.vaadin.tests.tb3.MultiBrowserTest;
  25. public class DateTimeFieldKeyboardInputTest extends MultiBrowserTest {
  26. @Test
  27. public void testValueChangeEvent() {
  28. openTestURL();
  29. WebElement dateFieldText = $(DateTimeFieldElement.class).first()
  30. .findElement(By.tagName("input"));
  31. dateFieldText.clear();
  32. int numLabelsBeforeUpdate = $(LabelElement.class).all().size();
  33. dateFieldText.sendKeys("20.10.2013 7:2", Keys.RETURN);
  34. int numLabelsAfterUpdate = $(LabelElement.class).all().size();
  35. assertTrue("Changing the date failed.",
  36. numLabelsAfterUpdate == numLabelsBeforeUpdate + 1);
  37. }
  38. }