}
DropDownFieldInspector dropDown = dropDownField("formID:styled");
ElementInspector button = dropDown.button();
ElementInspector field = dropDown.field();
DropDownPopupInspector popup = dropDown.popup();
List<ElementInspector> items = popup.items();
if (isFocused) {
if (isDropDown)
field.focus();
else
dropDown.focus();
} else {
if (isDropDown)
field.fireEvent("onblur");
else
dropDown.fireEvent("onblur");
}
if (!isDisabled) {
dropDown.assertExpressionEquals("offsetWidth", 230, 5);
if (isFocused) {
dropDown.assertStyle("border: 1px solid yellow;");
}
if (!isDropDown) {
dropDown.assertStyle("background: GreenYellow; font-weight: bold;");
}
if (isDropDown) {
button.assertStyle("border: 1px solid blue; background: PowderBlue;");
button.childNodes().get(0).assertAttributeStartsWith("src", "dropdown_arrow.gif");
field.assertStyle("background: GreenYellow; font-weight: bold;");
button.mouseDown();
button.assertStyle("border: 1px solid OrangeRed; background: PaleVioletRed;");
button.mouseUp();
if (!isFocused) {
field.fireEvent("onblur");
}
}
if (!isDropDown) {
dropDown.keyDown(KeyEvent.VK_DOWN);
if (!isFocused) {
dropDown.fireEvent("onblur");
}
}
ElementInspector item2 = items.get(2);
if (isDropDown)
item2.assertStyle("font-size: 18px;");
else
item2.childNodesByName("td").get(0).assertStyle("font-size: 18px;");
item2.assertStyle("color: Teal;");
popup.assertStyle("border: 1px dotted red");
TableInspector itemsTable = popup.itemsTable();
ElementInspector firstFooterCell = itemsTable.subElement("tfoot[0]/tr[0]/td[0]");
firstFooterCell.assertStyle("color: silver");
itemsTable.subElement("thead[0]/tr[0]").assertStyle("text-decoration: underline");
ElementInspector firstHeaderCell = itemsTable.subElement("thead[0]/tr[0]/td[0]");
firstHeaderCell.assertStyle("color: red");
items.get(1).assertStyle("background: bisque;");
items.get(2).subElement("td[0]").assertStyle("border-right: 1px solid blue; border-bottom: 2px dotted DarkOliveGreen");
firstHeaderCell.assertStyle("border-right: 2px dashed springgreen; border-bottom: 2px solid fuchsia");
firstFooterCell.assertStyle("border-right: 3px solid black; border-top: 2px solid green");
selenium.mouseMove("formID:styled");
if (isDropDown) {
if (!isFocused) { // focusedStyle has higher prioriry than rolloverStyle
field.assertStyle("border: 2px dashed MediumSpringGreen;");
}
button.assertStyle("border: 2px solid darkgreen; background: green;");
}
if (!isFocused) { // focusedStyle has higher prioriry than rolloverStyle
dropDown.assertStyle("border: 1px dotted darkblue;");
}
popup.assertStyle("border: 3px dotted pink");
// rolloverListItemStyle="color: orange; font: Comic Sans MS; background: LightGreen;"
submitElement.mouseMove();
items.get(2).mouseMove();
items.get(2).assertStyle("color: orange");