You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Timo Rantalaiho <Ti...@ri.fi> on 2008/11/03 04:19:00 UTC
Re: Testing + IFrame
On Fri, 31 Oct 2008, Bert van Heukelom wrote:
> I want to test an ajax upload component that uses an IFrame. I have
> difficulties when trying to access Components via their path that are
> contained in the IFrame. I manage to a reference of the Iframe but can not
> find a path-string that accesses a component (namly a form) within the
> Iframe.
Try doing wicketTester.debugComponentTrees() (or debugging
the exact hierarchy by yourself).
> FormTester f =
> wicketTester.newFormTester("path:to:my:iframe:and:to:its:inner:form");
Long component paths like this are a bit problematic anyway.
You could try digging your Form up with a visitor to make it
less dependent on the path.
Best wishes,
Timo
--
Timo Rantalaiho
Reaktor Innovations Oy <URL: http://www.ri.fi/ >
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: Testing + IFrame
Posted by Nino Saturnino Martinez Vazquez Wael <ni...@jayway.dk>.
Ahh ok..
Timo now that you've mentioned jdave... Are there any way jdave supports
plain text scenarios like jBehave?
Timo Rantalaiho wrote:
> On Mon, 03 Nov 2008, Nino Saturnino Martinez Vazquez Wael wrote:
>
>> Argh really bad example, heres a better one:
>>
>> tester.getComponent("basepath").getIframe().addvisitor or something?
>>
>> And then visitor would have to sort out if the component probed were a
>> form etc?
>>
>
> Something like
>
> Form form = (Form) tester.getLastRenderedPage().visitChildren(Form.class, new Component.IVisitor<Component>() {
> public Object component(Component component) {
> return component;
> });
> FormTester = tester.newFormTester(form);
>
> In jdave-wicket you have this bundled in and can do just
>
> Form form = selectFirst(Form.class).from(context);
>
> If there are more than one Form visible on the page, you have
> to differentiate a bit more in the visitor and it gets more
> messy.
>
> Best wishes,
> Timo
>
>
--
-Wicket for love
Nino Martinez Wael
Java Specialist @ Jayway DK
http://www.jayway.dk
+45 2936 7684
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: Testing + IFrame
Posted by Timo Rantalaiho <Ti...@ri.fi>.
On Mon, 03 Nov 2008, Nino Saturnino Martinez Vazquez Wael wrote:
> Argh really bad example, heres a better one:
>
> tester.getComponent("basepath").getIframe().addvisitor or something?
>
> And then visitor would have to sort out if the component probed were a
> form etc?
Something like
Form form = (Form) tester.getLastRenderedPage().visitChildren(Form.class, new Component.IVisitor<Component>() {
public Object component(Component component) {
return component;
});
FormTester = tester.newFormTester(form);
In jdave-wicket you have this bundled in and can do just
Form form = selectFirst(Form.class).from(context);
If there are more than one Form visible on the page, you have
to differentiate a bit more in the visitor and it gets more
messy.
Best wishes,
Timo
--
Timo Rantalaiho
Reaktor Innovations Oy <URL: http://www.ri.fi/ >
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: Testing + IFrame
Posted by Nino Saturnino Martinez Vazquez Wael <ni...@jayway.dk>.
Argh really bad example, heres a better one:
tester.getComponent("basepath").getIframe().addvisitor or something?
And then visitor would have to sort out if the component probed were a
form etc?
Nino Saturnino Martinez Vazquez Wael wrote:
> So in pseudo code you would:
>
> tester.getForm.add(IVisitorImplementation) ???
>
>
> Timo Rantalaiho wrote:
>> On Fri, 31 Oct 2008, Bert van Heukelom wrote:
>>
>>> I want to test an ajax upload component that uses an IFrame. I have
>>> difficulties when trying to access Components via their path that are
>>> contained in the IFrame. I manage to a reference of the Iframe but
>>> can not
>>> find a path-string that accesses a component (namly a form) within the
>>> Iframe.
>>>
>>
>> Try doing wicketTester.debugComponentTrees() (or debugging the exact
>> hierarchy by yourself).
>>
>>
>>> FormTester f =
>>> wicketTester.newFormTester("path:to:my:iframe:and:to:its:inner:form");
>>>
>>
>> Long component paths like this are a bit problematic anyway.
>> You could try digging your Form up with a visitor to make it
>> less dependent on the path.
>>
>> Best wishes,
>> Timo
>>
>>
>
--
-Wicket for love
Nino Martinez Wael
Java Specialist @ Jayway DK
http://www.jayway.dk
+45 2936 7684
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: Testing + IFrame
Posted by Nino Saturnino Martinez Vazquez Wael <ni...@jayway.dk>.
So in pseudo code you would:
tester.getForm.add(IVisitorImplementation) ???
Timo Rantalaiho wrote:
> On Fri, 31 Oct 2008, Bert van Heukelom wrote:
>
>> I want to test an ajax upload component that uses an IFrame. I have
>> difficulties when trying to access Components via their path that are
>> contained in the IFrame. I manage to a reference of the Iframe but can not
>> find a path-string that accesses a component (namly a form) within the
>> Iframe.
>>
>
> Try doing wicketTester.debugComponentTrees() (or debugging
> the exact hierarchy by yourself).
>
>
>> FormTester f =
>> wicketTester.newFormTester("path:to:my:iframe:and:to:its:inner:form");
>>
>
> Long component paths like this are a bit problematic anyway.
> You could try digging your Form up with a visitor to make it
> less dependent on the path.
>
> Best wishes,
> Timo
>
>
--
-Wicket for love
Nino Martinez Wael
Java Specialist @ Jayway DK
http://www.jayway.dk
+45 2936 7684
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org