Wicket tester and Ajax Confirm Link

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

Wicket tester and Ajax Confirm Link


I have an AjaxLink on my Page with a precondition.
Now I want to execute this link within a unit test via the wicket tester. Any idea, how to confirm the browser dialog too?

public abstract class ConfirmationLink<T> extends AjaxLink<T>
    private static final long serialVersionUID = 1L;
    private final String text;

    public ConfirmationLink(String id, String text)
        super( id );
        this.text = text;

    protected void updateAjaxAttributes(AjaxRequestAttributes attributes )
        super.updateAjaxAttributes( attributes );

        AjaxCallListener ajaxCallListener = new AjaxCallListener();
        ajaxCallListener.onPrecondition( "return confirm('" + text + "');" );
        attributes.getAjaxCallListeners().add( ajaxCallListener );

Link execution within the test:
tester.executeAjaxEvent("delete", "onClick");

Thanks for reading.