Search in sources :

Example 1 with Menu

use of com.googlecode.wicket.jquery.ui.widget.menu.Menu in project openmeetings by apache.

the class TestCalendar method testEventCreate.

@Test
public void testEventCreate() throws OmException {
    testArea(regularUsername, p -> {
        Menu menu = (Menu) p.get(PATH_MENU);
        Assert.assertNotNull(menu);
        tester.getRequest().setParameter("hash", menu.getItemList().get(0).getItems().get(1).getId());
        tester.executeBehavior((AbstractAjaxBehavior) menu.getBehaviorById(0));
        tester.assertComponent(PATH_CHILD, CalendarPanel.class);
        CalendarPanel cal = (CalendarPanel) p.get(PATH_CHILD);
        tester.executeAllTimerBehaviors(cal);
        User u = userDao.getByLogin(regularUsername, User.Type.user, null);
        // test create month
        tester.getRequest().setParameter("allDay", String.valueOf(false));
        tester.getRequest().setParameter("startDate", LocalDateTime.of(2017, 11, 13, 13, 13).toString());
        tester.getRequest().setParameter("endDate", LocalDateTime.of(2017, 11, 13, 13, 13).toString());
        tester.getRequest().setParameter("viewName", CalendarView.month.name());
        // select-event
        tester.executeBehavior((AbstractAjaxBehavior) cal.get("form:calendar").getBehaviorById(0));
        FormTester appTester = tester.newFormTester(PATH_APPOINTMENT_DLG_FRM);
        // check inviteeType:groupContainer:groups is invisible for regular user
        String title = String.format("title%s", UUID.randomUUID());
        appTester.setValue("title", title);
        ButtonAjaxBehavior save = getButtonBehavior(PATH_APPOINTMENT_DLG, "save");
        tester.executeBehavior(save);
        List<Appointment> appts = appointmentDao.searchByTitle(u.getId(), title);
        assertEquals("Appointment should be created", 1, appts.size());
        assertEquals("Appointment should be created", title, appts.get(0).getTitle());
    });
}
Also used : CalendarPanel(org.apache.openmeetings.web.user.calendar.CalendarPanel) Appointment(org.apache.openmeetings.db.entity.calendar.Appointment) User(org.apache.openmeetings.db.entity.user.User) FormTester(org.apache.wicket.util.tester.FormTester) Menu(com.googlecode.wicket.jquery.ui.widget.menu.Menu) ButtonAjaxBehavior(com.googlecode.wicket.jquery.ui.widget.dialog.ButtonAjaxBehavior) Test(org.junit.Test)

Example 2 with Menu

use of com.googlecode.wicket.jquery.ui.widget.menu.Menu in project openmeetings by apache.

the class TestMainMenu method checkMenuItem.

private void checkMenuItem(int idx1, int idx2, Class<? extends BasePanel> clazz) throws OmException {
    testArea(adminUsername, p -> {
        Menu menu = (Menu) p.get(PATH_MENU);
        Assert.assertNotNull(menu);
        tester.getRequest().setParameter("hash", menu.getItemList().get(idx1).getItems().get(idx2).getId());
        tester.executeBehavior((AbstractAjaxBehavior) menu.getBehaviorById(0));
        tester.assertComponent(PATH_CHILD, clazz);
    });
}
Also used : Menu(com.googlecode.wicket.jquery.ui.widget.menu.Menu)

Aggregations

Menu (com.googlecode.wicket.jquery.ui.widget.menu.Menu)2 ButtonAjaxBehavior (com.googlecode.wicket.jquery.ui.widget.dialog.ButtonAjaxBehavior)1 Appointment (org.apache.openmeetings.db.entity.calendar.Appointment)1 User (org.apache.openmeetings.db.entity.user.User)1 CalendarPanel (org.apache.openmeetings.web.user.calendar.CalendarPanel)1 FormTester (org.apache.wicket.util.tester.FormTester)1 Test (org.junit.Test)1