This content has been marked as final.
Show 1 reply
-
1. Re: Disable/Enable of buttons
ssilvert Feb 25, 2008 9:53 AM (in response to kingkon)You have several ways to test this. Assume you have a command button defined like this:
<h:commandButton value="Hello" action="/index.jsp" id="submit_button" disabled="#{mybean.enabled}"/>
You can test this from the server side using the JSFServerSession like this:JSFServerSession server = new JSFServerSession(client); HtmlCommandButton submitButton = (HtmlCommandButton)server.findComponent("submit_button"); assertTrue(submitButton.isDisabled());
From the client side you have several ways to find the component but the simplest in this case is to use the HttpUnit API:WebResponse response = client.getWebResponse(); String clientID = client.getClientIDs().findClientID("submit_button"); Button submitButton = (Button)response.getElementWithID(clientID); assertTrue(submitButton.isDisabled());
I prefer testing this sort of thing from the server side, which is a bit more powerful.
Stan