Examples of DateClassFieldEditPane


Examples of org.xwiki.appwithinminutes.test.po.DateClassFieldEditPane

    @IgnoreBrowser(value = "internet.*", version = "9\\.*", reason="See http://jira.xwiki.org/browse/XE-1177")
    })
    public void testDatePicker()
    {
        // First select a date using the picker and assert the value of the date input.
        DateClassFieldEditPane dateField = new DateClassFieldEditPane(editor.addField("Date").getName());
        DatePicker datePicker = dateField.openDatePicker();
        datePicker.setYear("2011");
        datePicker.setMonth("October");
        datePicker.setDay("13");
        datePicker.setHour("8 AM");
        datePicker.setMinute("15");
        String selectedDate = dateField.getDefaultValue();
        // Ignore the number of seconds.
        Assert.assertTrue(selectedDate.startsWith("13/10/2011 08:15:"));

        // Set the value of the date input and assert the date selected by the picker.
        dateField.setDefaultValue("17/03/2020 19:43:34");

        // Currently the date picker doesn't know how to parse a date with a specified format. The workaround is to pass
        // the date time stamp when generating the date input, but for this the page needs to be saved and reloaded.
        editor.clickSaveAndView().edit();
        datePicker = new DateClassFieldEditPane("date1").openDatePicker();

        Assert.assertEquals("2020", datePicker.getYear());
        Assert.assertEquals("March", datePicker.getMonth());
        Assert.assertEquals("17", datePicker.getDay());
        Assert.assertEquals("7 PM", datePicker.getHour());
View Full Code Here

Examples of org.xwiki.appwithinminutes.test.po.DateClassFieldEditPane

    @IgnoreBrowser(value = "internet.*", version = "9\\.*", reason="See http://jira.xwiki.org/browse/XE-1177")
    })
    public void testDateFormat()
    {
        // Add a date field and change the date format.
        DateClassFieldEditPane dateField = new DateClassFieldEditPane(editor.addField("Date").getName());
        dateField.openConfigPanel();
        String dateFormat = "yyyy.MM.dd";
        dateField.setDateFormat(dateFormat);

        // Close the configuration panel to refresh the date field preview.
        dateField.closeConfigPanel();

        // Select a date using the date picker.
        DatePicker datePicker = dateField.openDatePicker();
        // The current date format doesn't include time information.
        Assert.assertFalse(datePicker.hasHourSelector());
        datePicker.setDay("22");
        Calendar now = Calendar.getInstance();
        now.set(Calendar.DAY_OF_MONTH, 22);
        Assert.assertEquals(new SimpleDateFormat(dateFormat).format(now.getTime()), dateField.getDefaultValue());

        // Test if the date picker knows how to parse dates with a custom date format.
        // Set the value of the date input and assert the date selected by the picker.
        dateField.setDefaultValue("2012.11.10");

        // Currently the date picker doesn't know how to parse a date with a specified format. The workaround is to pass
        // the date time stamp when generating the date input, but for this the page needs to be saved and reloaded.
        editor.clickSaveAndView().edit();
        datePicker = new DateClassFieldEditPane("date1").openDatePicker();

        Assert.assertEquals("2012", datePicker.getYear());
        Assert.assertEquals("November", datePicker.getMonth());
        Assert.assertEquals("10", datePicker.getDay());
        Assert.assertFalse(datePicker.hasHourSelector());
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.