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.

DateTimeFieldDeclarativeTest.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.datefield;
  17. import org.junit.Test;
  18. import com.vaadin.tests.server.component.abstractdatefield.AbstractLocalDateTimeFieldDeclarativeTest;
  19. import com.vaadin.ui.DateTimeField;
  20. /**
  21. * Tests the declarative support for implementations of {@link DateTimeField}.
  22. *
  23. * @since 8.0
  24. * @author Vaadin Ltd
  25. */
  26. public class DateTimeFieldDeclarativeTest
  27. extends AbstractLocalDateTimeFieldDeclarativeTest<DateTimeField> {
  28. @Test
  29. public void remainingAttributes()
  30. throws InstantiationException, IllegalAccessException {
  31. String placeholder = "foo";
  32. String assistiveText = "at";
  33. boolean textFieldEnabled = false;
  34. String design = String.format(
  35. "<%s placeholder='%s' "
  36. + "assistive-text='%s' text-field-enabled='%s'/>",
  37. getComponentTag(), placeholder, assistiveText,
  38. textFieldEnabled);
  39. DateTimeField component = getComponentClass().newInstance();
  40. component.setPlaceholder(placeholder);
  41. component.setTextFieldEnabled(textFieldEnabled);
  42. component.setAssistiveText(assistiveText);
  43. testRead(design, component);
  44. testWrite(design, component);
  45. }
  46. @Override
  47. protected String getComponentTag() {
  48. return "vaadin-date-time-field";
  49. }
  50. @Override
  51. protected Class<? extends DateTimeField> getComponentClass() {
  52. return DateTimeField.class;
  53. }
  54. }