LayoutEditorFocusController { protected HTMLElement findScrollableParent(HTMLElement element) { HTMLElement scrollElement = null; while (element != null) { if (isScrollable(element)) { scrollElement = element; break; } else if (element.parentNode instanceof HTMLElement) { element = Js.cast(element.parentNode); } else { break; } } return scrollElement; }  void setTargetContainerView(Container.View view); void recordFocus(); void restoreFocus(); boolean isDirty();  }
@Test public void noScrollableParentTest() { HTMLElement element = mock(HTMLElement.class); element.style = mock(CSSStyleDeclaration.class); HTMLElement foundScrollParent = controller.findScrollableParent(element); assertNull(foundScrollParent); }
@Test public void withScrollableParentTest() { HTMLElement scrollParent = mock(HTMLElement.class); HTMLElement element = mock(HTMLElement.class); CSSStyleDeclaration style = mock(CSSStyleDeclaration.class); style.overflow = "auto"; scrollParent.style = style; element.parentNode = scrollParent; element.style = mock(CSSStyleDeclaration.class); HTMLElement foundScrollParent = controller.findScrollableParent(element); assertEquals(scrollParent, foundScrollParent); }