Exemplo n.º 1
0
  @Test
  public void testDayDisableFunction() {
    calendarAttributes.set(CalendarAttributes.dayDisableFunction, "disableTuesdays");
    int tuesdayDay = 3;
    // switch to next month to refresh classes
    calendar.openPopup().getHeaderControls().nextMonth();
    DayPicker proxiedDayPicker = calendar.openPopup().getProxiedDayPicker();
    CalendarDays tuesdays = proxiedDayPicker.getSpecificDays(tuesdayDay);
    tuesdays.removeSpecificDays(DayType.boundaryDay);
    for (CalendarDay tuesday : tuesdays) {
      assertFalse(tuesday.is(DayType.clickable), "All tuesdays should not be enabled.");
    }

    calendarAttributes.set(CalendarAttributes.dayDisableFunction, "null");

    tuesdays = proxiedDayPicker.getSpecificDays(tuesdayDay);
    tuesdays.removeSpecificDays(DayType.boundaryDay);

    for (CalendarDay tuesday : tuesdays) {
      assertTrue(tuesday.is(DayType.clickable), "All tuesdays should be enabled.");
    }
  }
Exemplo n.º 2
0
  @Test
  public void testDayClassFunction() {
    int tuesdayDay = 3;
    calendarAttributes.set(CalendarAttributes.dayClassFunction, "yellowTuesdays");
    // switch to next month to refresh classes
    calendar.openPopup().getHeaderControls().nextMonth();
    DayPicker proxiedDayPicker = calendar.openPopup().getProxiedDayPicker();
    CalendarDays tuesdays = proxiedDayPicker.getSpecificDays(tuesdayDay);
    tuesdays.removeSpecificDays(DayType.boundaryDay);

    for (CalendarDay tuesday : tuesdays) {
      assertTrue(tuesday.containsStyleClass("yellowDay"), "All tuesdays should be yellow.");
    }

    calendarAttributes.set(CalendarAttributes.dayClassFunction, "null");

    tuesdays = proxiedDayPicker.getSpecificDays(tuesdayDay);
    tuesdays.removeSpecificDays(DayType.boundaryDay);

    for (CalendarDay tuesday : tuesdays) {
      assertFalse(tuesday.containsStyleClass("yellowDay"), "All tuesdays should not be yellow.");
    }
  }