Skip to content

Commit 8c73fab

Browse files
authored
Remove unneeded yui scrolling (#1861)
1 parent a83d17f commit 8c73fab

1 file changed

Lines changed: 2 additions & 30 deletions

File tree

src/main/java/org/jenkinsci/test/acceptance/po/Control.java

Lines changed: 2 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -215,25 +215,8 @@ public void selectDropdownMenu(String displayName) {
215215
@Override
216216
protected WebElement find(String caption) {
217217
WebElement menuButton = resolve();
218-
try {
219-
WebElement menu = findElement(menuButton, by.xpath(".."));
220-
return findElement(menu, by.button(caption));
221-
} catch (NoSuchElementException e) {
222-
// With enough implementations registered the one we are looking for might
223-
// require scrolling in menu to become visible. This dirty hack stretch
224-
// yui menu so that all the items are visible.
225-
executeScript("YAHOO.util.Dom.batch("
226-
+ " document.querySelector('.yui-menu-body-scrolled'),"
227-
+ " function (el) {"
228-
+ " el.style.height = 'auto';"
229-
+ " YAHOO.util.Dom.removeClass(el, 'yui-menu-body-scrolled');"
230-
+ " }"
231-
+ ");");
232-
// we can not use `Select` as these are YUI menus and we need to wait for it to be visible
233-
WebElement menu =
234-
findElement(menuButton, by.xpath("ancestor::*[contains(@class,'yui-menu-button')]/.."));
235-
return findElement(menu, by.link(caption));
236-
}
218+
WebElement menu = findElement(menuButton, by.xpath(".."));
219+
return findElement(menu, by.button(caption));
237220
}
238221
};
239222

@@ -250,17 +233,6 @@ public void selectDropdownMenuAlt(Class<?> type) {
250233
protected WebElement find(String caption) {
251234
WebElement menuButton = resolve();
252235

253-
// With enough implementations registered the one we are looking for might
254-
// require scrolling in menu to become visible. This dirty hack stretch
255-
// yui menu so that all the items are visible.
256-
executeScript("YAHOO.util.Dom.batch("
257-
+ " document.querySelector('.yui-menu-body-scrolled'),"
258-
+ " function (el) {"
259-
+ " el.style.height = 'auto';"
260-
+ " YAHOO.util.Dom.removeClass(el, 'yui-menu-body-scrolled');"
261-
+ " }"
262-
+ ");");
263-
264236
Select context = new Select(findElement(
265237
menuButton,
266238
by.xpath("ancestor-or-self::*[contains(@class,'setting-input dropdownList')] | "

0 commit comments

Comments
 (0)