// Find text control
e = client.getElement(controlId+"tempValue");
assertNotNull("Control not found: "+controlId+"tempValue",e);
assertTrue("Control not expected type (HtmlTextInput): "+e.getClass(),e instanceof HtmlTextInput);
HtmlTextInput nameInput = (HtmlTextInput)e;
// Make sure input control is hidden
String hiddenStyle = nameInput.getStyleAttribute();
assertTrue("Input control not hidden as expected: ["+hiddenStyle+"]",
hiddenStyle.contains("display:none") || hiddenStyle.contains("display: none"));
// Activate control - click on outside table control
span.click();
// Make sure input control is now visible
String visibleStyle = nameInput.getStyleAttribute();
assertFalse("Input control not visible as expected: ["+visibleStyle+"]",
visibleStyle.contains("display:none") || visibleStyle.contains("display: none"));
// Type value into input control
nameInput.type(value);
// Type #3 - CUSTOM save button
if( customSaveId != null )
{
// Find and Click save button
e = client.getElement(customSaveId);
assertNotNull("Control not found: "+customSaveId,e);
assertTrue("Control not expected type (HtmlButton): "+e.getClass(),e instanceof HtmlButton);
HtmlButton saveButton = (HtmlButton)e;
saveButton.click();
}
else
{
// Check to see if buttons are visible
e = client.getElement(controlId+"bar");
assertNotNull("Control not found: "+controlId+"bar",e);
assertTrue("Control not expected type (HtmlDivision): "+e.getClass(),e instanceof HtmlDivision);
HtmlDivision buttons = (HtmlDivision)e;
String buttonStyle = buttons.getStyleAttribute();
// Type #1 - NO BUTTONS
if( buttonStyle.contains("display:none") || buttonStyle.contains("display: none") )
{
// Remove focus from name input control
nameInput.blur();
// Type #2 - built-in buttons
}
else
{
// Find and "mousedown" the standard "ok" button
e = client.getElement(controlId+"ok");
assertNotNull("Control not found: "+controlId+"ok",e);
assertTrue("Control not expected type (HtmlImageInput): "+e.getClass(),e instanceof HtmlImageInput);
HtmlImageInput okButton = (HtmlImageInput)e;
okButton.fireEvent("mousedown");
}
}
// Make sure name input is no longer visible
hiddenStyle = nameInput.getStyleAttribute();
assertTrue("Input control not hidden as expected: ["+hiddenStyle+"]",
hiddenStyle.contains("display:none") || hiddenStyle.contains("display: none"));
String inputValue = nameInput.getValueAttribute();
assertEquals("Input control value is not set as expected",_TEST_NAME_VALUE,inputValue);
// Find the hidden input control
e = client.getElement(controlId+"value");
assertNotNull("Control not found: "+controlId+"value",e);