-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathapp.R
63 lines (51 loc) · 1.77 KB
/
app.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
### Keep this line to manually test this shiny application. Do not edit this line; shinycoreci::::is_manual_app
library(shiny)
msg <- tags$h6(
"If it isn't already, make your window narrow enough so that a menu appears above (and to the right). ",
"Clicking that menu should show (and hide) a nav dropdown. ",
"Confirm that the nav dropdown can be shown/hidden, and that you can click",
"'Summary' to view a data summary (and 'Plot' to see a plot)."
)
jster <- shinyjster::shinyjster_js(
"
var jst = jster(0);
jst.add(Jster.shiny.waitUntilStable);
jst.add(function() {
var toggle = $('.navbar-toggle:visible');
var nav = $('.navbar-collapse:visible');
Jster.assert.isEqual(toggle.length, 1, 'Failed to find collapsible menu, does the window need to be resized?');
Jster.assert.isEqual(nav.length, 0, 'The collapsible navbar should not be visible by default');
toggle.click();
});
// wait for nav to open
jst.add(function(done) {
var wait = function() {
if ($('.navbar-collapse:visible').length > 0) {
done();
} else {
setTimeout(wait, 5);
}
}
wait();
});
jst.add(function() {
Jster.assert.isEqual(
$('.navbar-collapse:visible').length, 1,
'Clicking the navbar toggle should make the navbar appear.'
);
});
jst.test();
"
)
ui <- navbarPage(
theme = bslib::bs_global_get(),
"", collapsible = TRUE,
tabPanel("Plot", msg, plotOutput("plot")),
tabPanel("Summary", msg, verbatimTextOutput("summary"), jster)
)
server <- function(input, output, session) {
shinyjster::shinyjster_server(input, output, session)
output$plot <- renderPlot(plot(cars))
output$summary <- renderPrint(summary(cars))
}
shinyApp(ui, server)