@Test public void testDisableWarningHighlight() { final String warningElementSelector = "." + WARNING_CSS_CLASS; final HTMLElement element = mock(HTMLElement.class); final HTMLElement parentElement = mock(HTMLElement.class); final NodeList<Element> warningElements = spy(new NodeList<>()); final Element warningElement1 = mock(Element.class); final Element warningElement2 = mock(Element.class); doReturn(warningElement1).when(warningElements).getAt(0); doReturn(warningElement2).when(warningElements).getAt(1); doReturn(element).when(view).getElement(); when(parentElement.querySelectorAll(warningElementSelector)).thenReturn(warningElements); element.parentNode = parentElement; warningElements.length = 2; warningElement1.classList = mock(DOMTokenList.class); warningElement2.classList = mock(DOMTokenList.class); view.disableWarningHighlight(); verify(warningElement1.classList).remove(WARNING_CSS_CLASS); verify(warningElement2.classList).remove(WARNING_CSS_CLASS); }
void disableWarningHighlight() { final NodeList<Element> warningElements = getElement().parentNode.querySelectorAll("." + WARNING_CSS_CLASS); for (int i = 0; i < warningElements.length; i++) { warningElements.getAt(i).classList.remove(WARNING_CSS_CLASS); } }
FlashMessagesView implements FlashMessages.View { void disableWarningHighlight() { final NodeList<Element> warningElements = getElement().parentNode.querySelectorAll("." + WARNING_CSS_CLASS); for (int i = 0; i < warningElements.length; i++) { warningElements.getAt(i).classList.remove(WARNING_CSS_CLASS); } } }
FlashMessagesView implements FlashMessages.View { void disableWarningHighlight() { final NodeList<Element> warningElements = getElement().parentNode.querySelectorAll("." + WARNING_CSS_CLASS); for (int i = 0; i < warningElements.length; i++) { warningElements.getAt(i).classList.remove(WARNING_CSS_CLASS); } } @Inject  FlashMessagesView(final HTMLDivElement errorContainer,
                             final HTMLDivElement warningContainer,
                             final @Named("strong") HTMLElement strongErrorMessage,
                             final @Named("span") HTMLElement regularErrorMessage,
                             final @Named("strong") HTMLElement strongWarningMessage,
                             final @Named("span") HTMLElement regularWarningMessage,
                             final HTMLButtonElement okWarningButton,
                             final HTMLButtonElement cancelWarningButton,
                             final HTMLButtonElement closeSuccessButton,
                             final HTMLDivElement successContainer,
                             final @Named("strong") HTMLElement strongSuccessMessage,
                             final @Named("span") HTMLElement regularSuccessMessage); }
FlashMessagesView implements FlashMessages.View { void disableWarningHighlight() { final NodeList<Element> warningElements = getElement().parentNode.querySelectorAll("." + WARNING_CSS_CLASS); for (int i = 0; i < warningElements.length; i++) { warningElements.getAt(i).classList.remove(WARNING_CSS_CLASS); } } @Inject  FlashMessagesView(final HTMLDivElement errorContainer,
                             final HTMLDivElement warningContainer,
                             final @Named("strong") HTMLElement strongErrorMessage,
                             final @Named("span") HTMLElement regularErrorMessage,
                             final @Named("strong") HTMLElement strongWarningMessage,
                             final @Named("span") HTMLElement regularWarningMessage,
                             final HTMLButtonElement okWarningButton,
                             final HTMLButtonElement cancelWarningButton,
                             final HTMLButtonElement closeSuccessButton,
                             final HTMLDivElement successContainer,
                             final @Named("strong") HTMLElement strongSuccessMessage,
                             final @Named("span") HTMLElement regularSuccessMessage); @Override void init(final FlashMessages presenter); @EventHandler("close-success-message-button") void onCloseSuccessButtonClick(final ClickEvent e); @EventHandler("ok-warning-button") void onOkWarningButtonClick(final ClickEvent e); @EventHandler("cancel-warning-button") void onCancelWarningButtonClick(final ClickEvent e); @Override void showErrorMessage(final String strongMessage,
                                 final String regularMessage); @Override void showWarningMessage(final String strongMessage,
                                   final String regularMessage); @Override void showSuccessMessage(final String strongMessage,
                                   final String regularMessage); @Override void showErrorHighlight(final String errorElementSelector); @Override void showWarningHighlight(final String warningElementSelector); @Override boolean isElementPresent(final String elementSelector); @Override void hideWarningContainer(); @Override void hideSuccessContainer(); @Override void hideErrorContainer(); }
FlashMessagesView implements FlashMessages.View { void disableWarningHighlight() { final NodeList<Element> warningElements = getElement().parentNode.querySelectorAll("." + WARNING_CSS_CLASS); for (int i = 0; i < warningElements.length; i++) { warningElements.getAt(i).classList.remove(WARNING_CSS_CLASS); } } @Inject  FlashMessagesView(final HTMLDivElement errorContainer,
                             final HTMLDivElement warningContainer,
                             final @Named("strong") HTMLElement strongErrorMessage,
                             final @Named("span") HTMLElement regularErrorMessage,
                             final @Named("strong") HTMLElement strongWarningMessage,
                             final @Named("span") HTMLElement regularWarningMessage,
                             final HTMLButtonElement okWarningButton,
                             final HTMLButtonElement cancelWarningButton,
                             final HTMLButtonElement closeSuccessButton,
                             final HTMLDivElement successContainer,
                             final @Named("strong") HTMLElement strongSuccessMessage,
                             final @Named("span") HTMLElement regularSuccessMessage); @Override void init(final FlashMessages presenter); @EventHandler("close-success-message-button") void onCloseSuccessButtonClick(final ClickEvent e); @EventHandler("ok-warning-button") void onOkWarningButtonClick(final ClickEvent e); @EventHandler("cancel-warning-button") void onCancelWarningButtonClick(final ClickEvent e); @Override void showErrorMessage(final String strongMessage,
                                 final String regularMessage); @Override void showWarningMessage(final String strongMessage,
                                   final String regularMessage); @Override void showSuccessMessage(final String strongMessage,
                                   final String regularMessage); @Override void showErrorHighlight(final String errorElementSelector); @Override void showWarningHighlight(final String warningElementSelector); @Override boolean isElementPresent(final String elementSelector); @Override void hideWarningContainer(); @Override void hideSuccessContainer(); @Override void hideErrorContainer();  }