* optional block inside the dropdownDescriptorSelector
*/
public void test2() throws Exception {
HtmlPage p = createWebClient().goTo("self/test2");
HtmlSelect s = (HtmlSelect)p.selectSingleNode("//SELECT");
List<HtmlOption> opts = s.getOptions();
// those first selections will load additional HTMLs
s.setSelectedAttribute(opts.get(0),true);
s.setSelectedAttribute(opts.get(1),true);
// now select back what's already loaded, to cause the existing elements to be displayed
s.setSelectedAttribute(opts.get(0),true);
// make sure that the inner control is still hidden
List<HtmlInput> textboxes = p.selectNodes("//INPUT[@name='_.textbox2']");
assertEquals(2,textboxes.size());
for (HtmlInput e : textboxes)
assertTrue(!e.isDisplayed());
// reveal the text box
List<HtmlInput> checkboxes = p.selectNodes("//INPUT[@name='inner']");
assertEquals(2,checkboxes.size());
checkboxes.get(0).click();
assertTrue(textboxes.get(0).isDisplayed());
textboxes.get(0).type("Budweiser");
// toggle the selection again
s.setSelectedAttribute(opts.get(1),true);
s.setSelectedAttribute(opts.get(0),true);
// make sure it's still displayed this time
assertTrue(checkboxes.get(0).isChecked());
assertTrue(textboxes.get(0).isDisplayed());