[jsfunit-dev] Ajax4JSF in JSFUnit
Stan Silvert
ssilvert at redhat.com
Mon Jul 30 08:37:53 EDT 2007
Julien Viet wrote:
> coo, does it support DnD ?
I haven't tried it, but it probably works. If not, all I have to do is
look at what it sends to the server on DnD events and add it to the request.
Anybody want to try it out?
Stan
>
> On 25 juil. 07, at 21:40, Stan Silvert wrote:
>
>> FYI, I just finished the ajax4jsf support and an example application.
>> It's really three apps in one. I combined three of the ajax4jsf
>> sample apps into one WAR and wrote tests for them. You can see this in:
>> jsfunit/jboss-jsfunit-examples/jboss-jsfunit-examples-ajax4jsf
>>
>> The only thing left to add to the example is an index page that lets
>> you run the tests from the browser.
>>
>> There is no library I have found that adequately handles the
>> javascript for the A4J components. So for AJAX, you are only testing
>> the server side and not the dynamic things that would happen in the
>> browser.
>>
>> The Ajax4jsfClient creates the same HTTP request that would be sent by
>> the A4J.AJAX.Submit javascript function. After that request, it sends
>> a second request to the server that does a page refresh, which keeps
>> the client and server side in sync.
>>
>> For example, I have a page with this form:
>>
>> <h:form id="form1">
>> <h:inputText id="input_text" size="50" value="#{textbean.text}">
>> <a4j:support id="a4jsupport" event="onkeyup" reRender="rep"/>
>> </h:inputText>
>> <h:outputText value="#{textbean.text}" id="rep"/>
>> </h:form>
>>
>>
>> The code to test the AJAX submit looks something like this:
>>
>> ClientFacade client = new ClientFacade("/pages/echo.jsf");
>> Ajax4jsfClient ajaxClient = new Ajax4jsfClient(client);
>> ServerFacade server = new ServerFacade(client);
>> client.setParameter("input_text", "foo");
>> ajaxClient.fireAjaxEvent("a4jsupport");
>> assertEquals("foo", server.getManagedBeanValue("#{textbean.text}"));
>>
>> Stan
>> _______________________________________________
>> jsfunit-dev mailing list
>> jsfunit-dev at lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/jsfunit-dev
>
> Julien Viet
> JBoss Portal Project Lead
> Red Hat Inc.
>
> http://jbossportal.blogspot.com/
>
> Red Hat France SARL, 171 Avenue Georges Clemenceau, 92024 Nanterre
> Cedex, France.
> Siret n° 421 199 464 00056
>
>
More information about the jsfunit-dev
mailing list