Skip to content

Commit ce7efbe

Browse files
committed
Further refine shiny app
1 parent d9be2ea commit ce7efbe

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

NEWS.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# testthat (development version)
22

3-
* `snapshot_review()` disables the skip button if there's only one snapshot to review (#2025).
3+
* `snapshot_review()` includes a reject button and only displays the file navigation and the skip button if there are multiple files to review (#2025).
44
* `test_dir()`, `test_file()`, `test_package()`, `test_check()`, `test_local()`, `source_file()` gain a `shuffle` argument uses `sample()` to randomly reorder the top-level expressions in each test file (#1942). This random reordering surfaces dependencies between tests and code outside of any test, as well as dependencies between tests. This helps you find and eliminate unintentional dependencies.
55
* `snapshot_accept(test)` now works when the test file name contains `.` (#1669).
66
* `local_mock()` and `with_mock()` have been deprecated because they are no longer permitted in R 4.5.

R/snapshot-manage.R

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,15 +73,16 @@ review_app <- function(name, old_path, new_path, ...) {
7373
ui <- shiny::fluidPage(
7474
style = "margin: 0.5em",
7575
shiny::fluidRow(
76-
style = "display: flex",
76+
style = "display: flex; margin-bottom: 0.5em",
7777
shiny::div(
7878
style = "flex: 1 1",
79-
shiny::selectInput("cases", NULL, case_index, width = "100%")
79+
if (n > 1) shiny::selectInput("cases", NULL, case_index, width = "100%")
8080
),
8181
shiny::div(
8282
class = "btn-group",
8383
style = "margin-left: 1em; flex: 0 0 auto",
84-
shiny::actionButton("skip", "Skip"),
84+
shiny::actionButton("reject", "Reject", class = "btn-danger"),
85+
if (n > 1) shiny::actionButton("skip", "Skip"),
8586
shiny::actionButton("accept", "Accept", class = "btn-success"),
8687
)
8788
),
@@ -90,7 +91,7 @@ review_app <- function(name, old_path, new_path, ...) {
9091
)
9192
)
9293
server <- function(input, output, session) {
93-
i <- shiny::reactive(as.numeric(input$cases))
94+
i <- shiny::reactive(if (n == 1) 1L else as.numeric(input$cases))
9495
output$diff <- diffviewer::visual_diff_render({
9596
diffviewer::visual_diff(old_path[[i()]], new_path[[i()]])
9697
})

0 commit comments

Comments
 (0)