[
https://issues.apache.org/jira/browse/WICKET-7030?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Johannes Renoth updated WICKET-7030:
------------------------------------
Description:
Since BasewicketTester does not have methods to conveniently search for
components by wicket ID from last last rendered page, we could add them.
For example we could add
{code:java}
Optional<Component> getFirstComponentByWicketId(String id)
List<Component> getAllComponentsByWicketId(String id)
{code}
to enable the Tester to do the following without the manual use of IVisitor
{code:java}
tester.startComponentInPage(myComponent);
var nestedComponent = tester.getFirstComponentByWicketId("myNestedComponent");
assertThat(nestedComponent).isPresent(). ...
// Other Example
tester.startComponentInPage(myComponentWithListView);
var result = tester.getAllComponentsByWicketId("repeterNestedItem");
assertThat(result).hasSize(4)
.extracting(c -> c.isVisible())
.containsExactly(true, false, true, true);
{code}
was:
Since BasewicketTester does not have methods to conveniently search for
components from last last rendered page, we could add them.
For example we could add
{code:java}
Optional<Component> getFirstComponentByWicketId(String id)
List<Component> getAllComponentsByWicketId(String id)
{code}
to enable the Tester to do the following without the manual use of IVisitor
{code:java}
tester.startComponentInPage(myComponent);
var nestedComponent = tester.getFirstComponentByWicketId("myNestedComponent");
assertThat(nestedComponent).isPresent(). ...
// Other Example
tester.startComponentInPage(myComponentWithListView);
var result = tester.getAllComponentsByWicketId("repeterNestedItem");
assertThat(result).hasSize(4)
.extracting(c -> c.isVisible())
.containsExactly(true, false, true, true);
{code}
> Add Convenience Methods in BaseWicketTester
> -------------------------------------------
>
> Key: WICKET-7030
> URL: https://issues.apache.org/jira/browse/WICKET-7030
> Project: Wicket
> Issue Type: Improvement
> Components: wicket-core
> Reporter: Johannes Renoth
> Priority: Minor
>
> Since BasewicketTester does not have methods to conveniently search for
> components by wicket ID from last last rendered page, we could add them.
> For example we could add
> {code:java}
> Optional<Component> getFirstComponentByWicketId(String id)
> List<Component> getAllComponentsByWicketId(String id)
> {code}
> to enable the Tester to do the following without the manual use of IVisitor
> {code:java}
> tester.startComponentInPage(myComponent);
> var nestedComponent = tester.getFirstComponentByWicketId("myNestedComponent");
> assertThat(nestedComponent).isPresent(). ...
> // Other Example
> tester.startComponentInPage(myComponentWithListView);
> var result = tester.getAllComponentsByWicketId("repeterNestedItem");
> assertThat(result).hasSize(4)
> .extracting(c -> c.isVisible())
> .containsExactly(true, false, true, true);
> {code}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)