@Test
 @Use(
     field = "booleanValue",
     booleans = {false, true})
 public void testShowWeeksBar() {
   calendarAttributes.set(CalendarAttributes.showWeeksBar, booleanValue);
   DayPicker proxiedDayPicker = calendar.openPopup().getProxiedDayPicker();
   if (booleanValue) {
     assertVisible(proxiedDayPicker.getWeek(1).getWeekNumberElement());
   } else {
     assertNotVisible(proxiedDayPicker.getWeek(1).getWeekNumberElement());
   }
 }
  @Test
  @RegressionTest("https://issues.jboss.org/browse/RF-9646")
  public void testFirstWeekDay() {
    DayPicker proxiedDayPicker = calendar.openPopup().getProxiedDayPicker();
    List<String> weekDays = Arrays.asList("Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat");

    assertEquals(proxiedDayPicker.getWeekDayShortNames(), weekDays);

    // wrong input, nothing changes, RF-9646
    calendarAttributes.set(CalendarAttributes.firstWeekDay, 7);
    assertEquals(proxiedDayPicker.getWeekDayShortNames(), weekDays);

    calendarAttributes.set(CalendarAttributes.firstWeekDay, 1);
    Collections.rotate(weekDays, -1);
    assertEquals(proxiedDayPicker.getWeekDayShortNames(), weekDays);
  }
  @Test
  @Use(field = "boundaryDatesMode", enumeration = true)
  public void testBoundaryDatesMode() {
    calendarAttributes.set(CalendarAttributes.boundaryDatesMode, boundaryDatesMode.value);
    DayPicker proxiedDayPicker = calendar.openPopup().getProxiedDayPicker();
    MetamerPage.waitRequest(calendar, WaitRequestType.XHR).setDateTime(firstOfNovember2012);
    PopupFooterControls proxiedFooterControls = calendar.openPopup().getProxiedFooterControls();
    HeaderControls proxiedHeaderControls = calendar.openPopup().getProxiedHeaderControls();
    DateTime yearAndMonth;
    String firstOfNovember2012String = firstOfNovember2012.toString(dateTimeFormatter);
    switch (boundaryDatesMode) {
      case INACTIVE:
      case NULL:
        MetamerPage.waitRequest(proxiedDayPicker.getBoundaryDays().get(0), WaitRequestType.NONE)
            .select();
        // apply and check, that the date has not changed
        MetamerPage.waitRequest(proxiedFooterControls, WaitRequestType.NONE).applyDate();
        assertEquals(calendar.getInputValue(), firstOfNovember2012String);
        break;
      case SCROLL:
        // scroll to 28th of October 2012
        MetamerPage.waitRequest(proxiedDayPicker.getBoundaryDays().get(0), WaitRequestType.NONE)
            .select();
        yearAndMonth = proxiedHeaderControls.getYearAndMonth();
        assertEquals(yearAndMonth.getYear(), 2012);
        assertEquals(yearAndMonth.getMonthOfYear(), 10);
        // apply and check, that the date has not changed
        MetamerPage.waitRequest(proxiedFooterControls, WaitRequestType.NONE).applyDate();
        assertEquals(calendar.getInputValue(), firstOfNovember2012String);
        break;
      case SELECT:
        // select 28th of October 2012
        MetamerPage.waitRequest(proxiedDayPicker.getBoundaryDays().get(0), WaitRequestType.NONE)
            .select();
        yearAndMonth = proxiedHeaderControls.getYearAndMonth();
        assertEquals(yearAndMonth.getYear(), 2012);
        assertEquals(yearAndMonth.getMonthOfYear(), 10);

        MetamerPage.waitRequest(proxiedFooterControls, WaitRequestType.XHR).applyDate();
        DateTime parsedDateTime = dateTimeFormatter.parseDateTime(calendar.getInputValue());
        assertEquals(parsedDateTime.getYear(), 2012);
        assertEquals(parsedDateTime.getMonthOfYear(), 10);
        assertEquals(parsedDateTime.getDayOfMonth(), 28);
        break;
    }
  }
  @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.");
    }
  }
  @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.");
    }
  }
  @Test
  public void testLocale() {
    String locale = "ru";
    calendarAttributes.set(CalendarAttributes.locale, locale);
    DayPicker proxiedDayPicker = calendar.openPopup().getProxiedDayPicker();
    List<String> weekDayShortNames = proxiedDayPicker.getWeekDayShortNames();
    List<String> expectedShortNames = Arrays.asList("Вс", "Пн", "Вт", "Ср", "Чт", "Пт", "Сб");
    assertEquals(weekDayShortNames, expectedShortNames);

    setCurrentDateWithCalendarsTodayButtonAction.perform();
    DateTime parsedDateTime =
        dateTimeFormatter.withLocale(new Locale(locale)).parseDateTime(calendar.getInputValue());

    assertEquals(
        parsedDateTime.getDayOfMonth(),
        todayMidday.getDayOfMonth(),
        "Input doesn't contain selected date.");
    assertEquals(
        parsedDateTime.getMonthOfYear(),
        todayMidday.getMonthOfYear(),
        "Input doesn't contain selected date.");
    assertEquals(
        parsedDateTime.getYear(), todayMidday.getYear(), "Input doesn't contain selected date.");
  }