RinteRface / shinydashboardPlus

extensions for shinydashboard
https://shinydashboardplus.rinterface.com
Other
454 stars 77 forks source link

shinytest compatibility - dashboardPage #118

Open baxb94 opened 3 years ago

baxb94 commented 3 years ago

When using the shinydashboard::sidebarMenu, shinytest is unable to identify the sidebar in the inputs. This only occurs when using the shinydashboardPlus::dashboardPage. When I print the shinytest listWidgets, there is no sidebar element in the inputs.

I have tried the following: This works (using just shiny dashboard) Code

shinydashboard::dashboardPage(
  sidebar = shinydashboard::dashboardSidebar(
    shinydashboard::sidebarMenu(
      id = "sidebar",
      ..
    )
  )
)

Output

print(app$listWidgets())
$input
 [1] "sidebarCollapsed"                 "sidebarItemExpanded"              "sidebar"    ...

This does not work (using plus dashboard page with normal sidebar):

shinydashboardPlus::dashboardPage(
  sidebar = shinydashboard::dashboardSidebar(
    shinydashboard::sidebarMenu(
      id = "sidebar",
      ..
    )
  )
)

Output

print(app$listWidgets())
$input
 [1]  ...

This does not work (using plus dashboard page with plus sidebar):

shinydashboardPlus::dashboardPage(
  sidebar = shinydashboardPlus::dashboardSidebar(
    shinydashboard::sidebarMenu(
      id = "sidebar",
      ..
    )
  )
)

Output

print(app$listWidgets())
$input
 [1]  ...

This does not work (using plus dashboard page with plus sidebar with id):

shinydashboardPlus::dashboardPage(
  sidebar = shinydashboardPlus::dashboardSidebar(
    id = "some-id",
    shinydashboard::sidebarMenu(
      id = "sidebar",
      ..
    )
  )
)

Output

print(app$listWidgets())
$input
 [1]  ...

Without compatibility with shinytest, it is making it impossible to run UI snapshot simulation tests using shinydashboardPlus.