rstudio / shinydashboard

Shiny Dashboarding framework
https://rstudio.github.io/shinydashboard/
Other
892 stars 300 forks source link

"clicking" on a sidebar item in shinytest does not expand it #257

Closed wch closed 6 years ago

wch commented 6 years ago

PR #256 allows selecting a tab with shinytest, but does not expand sidebar menu items with children.

Here is a first pass at an implementation in sidebarmenuExpandedInputBinding, though it does not yet work:

  setValue: function(el, value) {
    var $menuItem = $(el).find("[data-expanded='" + value + "']");
    var $menu = $menuItem.next();
    // If this menuItem was already open, then clicking on it again,
    // should trigger the "hidden" event, so Shiny doesn't worry about
    // it while it's hidden (and vice versa).
    if ($menu.hasClass("menu-open")) $menu.trigger("hidden");
    else if ($menu.hasClass("treeview-menu")) $menu.trigger("shown");
  },