testPreventHide() {
    const node = dom.getElement('demoMenuButton');
    menuButton.decorate(node);
    menuButton.setDispatchTransitionEvents(Component.State.OPENED, true);

    // Show the menu.
    menuButton.setOpen(true);
    assertTrue('Menu button should be open.', menuButton.isOpen());
    assertTrue('Menu should be visible.', menuButton.getMenu().isVisible());

    const key =
        events.listen(menuButton, Component.EventType.CLOSE, (event) => {
          event.preventDefault();
        });

    // Try to hide the menu.
    menuButton.setOpen(false);
    assertTrue('Menu button should still be open.', menuButton.isOpen());
    assertTrue(
        'Menu should still be visible.', menuButton.getMenu().isVisible());

    // Remove listener and try again.
    events.unlistenByKey(key);
    menuButton.setOpen(false);
    assertFalse('Menu button should not be open.', menuButton.isOpen());
    assertFalse(
        'Menu should not be visible.', menuButton.getMenu().isVisible());
  }
Tests that preventing the button from closing also prevents the menu from
being hidden.