*/
protected void checkActionInputType() throws ProtocolException {
DOMOutputBuffer buffer = new DOMOutputBuffer();
buffer.initialise();
XFActionAttributes attributes = new XFActionAttributes();
attributes.setStyles(StylesBuilder.getInitialValueStyles());
// Setup test for normal behaviour for input tag generation (submit)
String name = "My Name";
String actionType = "submit";
String caption = "This is my caption";
String value = "This is my value";
attributes.setName(name);
attributes.setType(actionType);
attributes.setCaption(new LiteralTextAssetReference(caption));
attributes.setValue(value);
protocol.doActionInput(buffer, attributes);
String actualResult = bufferToString(buffer);
assertEquals("DOM buffer should match",
"<input name=\"" + name + "\" " +
"type=\"" + actionType + "\" value=\"" + caption + "\"/>",
actualResult);
// Setup test for normal behaviour for input tag generation (perform)
buffer = new DOMOutputBuffer();
buffer.initialise();
actionType = "perform";
attributes.setType(actionType);
protocol.doActionInput(buffer, attributes);
actualResult = bufferToString(buffer);
assertEquals("DOM buffer should match",
"<input name=\"" + name + "\" " +
"type=\"" + "submit" + "\" value=\"" + caption + "\"/>",
actualResult);
// Setup test for normal behaviour for input tag generation (perform)
buffer = new DOMOutputBuffer();
buffer.initialise();
actionType = "reset";
attributes.setType(actionType);
protocol.doActionInput(buffer, attributes);
actualResult = bufferToString(buffer);
assertEquals("DOM buffer should match",
"<input name=\"" + name + "\" " +
"type=\"" + actionType + "\" value=\"" + caption + "\"/>",
actualResult);
// Setup test for abnormal behaviour - garbage actionType
buffer = new DOMOutputBuffer();
buffer.initialise();
actionType = "GARBAGE";
attributes.setType(actionType);
try {
protocol.doActionInput(buffer, attributes);
fail("Should have thrown an IllegalArgumentException");
} catch (IllegalArgumentException e) {
}
// Setup test for abnormal behaviour - garbage actionType
buffer = new DOMOutputBuffer();
buffer.initialise();
actionType = "submit";
attributes.setType(actionType);
attributes.setTabindex("1");
protocol.doActionInput(buffer, attributes);
assertTrue(protocol.supportsTabindex);
actualResult = bufferToString(buffer);
assertEquals("DOM buffer should match",
"<input name=\"" + name + "\" " +