You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Java Programmer <jp...@gmail.com> on 2010/01/13 13:14:05 UTC
DataView component path in WicketTester
Hello,
Is it possible in WicketTester to check the items which are inside
DataView - an example:
DataView dataView = new DataView ("sampleDataView", provider, 10) {
@Override
protected void populateItem(Item sampleItem) {
sampleItem.add(new Label("title", new Model()));
}
}
and in WicketTester I want to:
getWicketTester().assertComponent("sampleDataView: something :title",
DataView.class);
How can I get that 'something' for the test?
Regards,
Adr
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: DataView component path in WicketTester
Posted by Alexander Elsholz <al...@widas.de>.
hi,
here my "hack" to test tables:
override: newChildId() in your dataview - class.
and build a common assert method...
private static final String PATH_CELLS = ":cells:";
private static final String PATH_ROWS = ":rows:";
protected final void assertTable(String pTablePath, int pRow, int pColumn,
String pText) {
assertComponent(pTablePath, YourDataView.class);
long lRowIndex = getRowIndex(pTablePath, pRow);
assertText(pTablePath + PATH_ROWS + (lRowIndex) + PATH_CELLS +
(pColumn + 1) + ":cell:"...........", pText);
}
private long getRowIndex(String pTablePath, int pRow) {
YourDataView lTable = (YourDataView)
baseWicketTester.getComponentFromLastRenderedPage(pTablePath);
long lChildID = lTable.getCurrentChildID();
int lSizeOfTable = lTable.getDataProvider().size();
long lRowIndex = lChildID - lSizeOfTable + pRow + 1;
return lRowIndex;
}
insert your cell stuff to path and the most important thing:
vote for better wickettestersupport in 1.5;-)
alex
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: DataView component path in WicketTester
Posted by Java Programmer <jp...@gmail.com>.
2010/1/13 Java Programmer <jp...@gmail.com>:
> and in WicketTester I want to:
> getWicketTester().assertComponent("sampleDataView: something :title",
> DataView.class);
>
Of course should be:
getWicketTester().assertComponent("sampleDataView: something :title",
Label.class);
Sorry for mistake,
Adr
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org