Dear Wicket Devs,
I'd like to ask you for starting a discussion about unifying how "click"
and "submit" are handled in WicketTester/FormTester.
Facts:
*1) clickLink and Buttons*
Currently WicketTester has "#clickLink" method. Its javadoc says:
/"When clicking an AjaxSubmitLink the form, which the AjaxSubmitLink is
attached to is first submitted, and then the onSubmit method on
AjaxSubmitLink is invoked. If you have changed some values in the form
during your test, these will also be submitted. This should not be used
as a replacement for the {@link FormTester} to test your forms. It
should be used to test that the code in your onSubmit method in
AjaxSubmitLink actually works."/
As I stated in https://issues.apache.org/jira/browse/WICKET-6442 it
possibly could work also for SubmitButton, but as Martin Grigorov
rightly noticed:
/"clickLink should not deal with Buttons."/
And also:
/"clickLink() is there since early versions and it is hard to remove it
now. We don't want #clickButton(), #submitButton(), #blurButton(),
#hoverLabel(), etc."/
*
*
*2) checkboxes*
Checkboxes are not only used in forms. AjaxCheckbox often serves as
"Enable/Disable" or "Show/Hide" trigger.
It is "logical" that if I *click* checkbox - its action is invoked.
Right? Unfortunately not. It occurs that first I must "set it to true"
(https://issues.apache.org/jira/browse/WICKET-6447)
It's not the way users interact with application and in my opinion it
shouldn't be tested that way because it's cumbersome and away from reality.
*
*
*3) **submitting forms*
It occurs that FormTester #submit method works in a strange way (it
submits form without "submit button", but doesn't submit anything if it
has default button https://issues.apache.org/jira/browse/WICKET-6446)
which seem weird to me.
As Sven Meier noticed:
/There are thousands of tests out there, we won't break these by
changing the semantics of a method.//
//Feel free to submit a pull request that adds a new method to
FormTester, e.g. #submitDefaultButton()/
But I don't think that another submit method (remember that
BaseWicketTester already has two: #submitForm(Form<?>) and
#submitForm(String) ) is what you want (recall what Martin Grigorov said)
*Sum up:*
1) What do you think about single "clickIt" method that you can use to
click on a link/button or checkbox?
2) What do you think about submit method , which can submit form without
any submit button or with the default one?
3) Wicket8 is going to be released soon and I think that it's perfect
occasion, to clean the API and even break compatibility (when necessary)
for the sake of better API
*When is better time than now to straighten this up?*
Kind regards,
Kamil