Skip to content

Commit

Permalink
narrow down screenshot
Browse files Browse the repository at this point in the history
  • Loading branch information
maxheld83 committed Nov 19, 2024
1 parent 6153b68 commit 4c38fa7
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 6 deletions.
7 changes: 5 additions & 2 deletions R/module2app.R
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,10 @@ module2app <- function(module_ui = NULL,
attributes(res),
list(
crow_screenshot_args = list(
selector = paste0("#", inner_module_id)
# need to select down to child
# because only that actually has a height
# the parent div may not, and will then fail the screenshot
selector = paste0("#", inner_module_id, " > *")
)
)
)
Expand Down Expand Up @@ -79,7 +82,7 @@ module2app_ui <- function(module_ui = NULL,
shiny::h2("Server Input Arguments"),
mixed_react_tree_ui("inputs"),
shiny::h2("Module UI"),
shiny::wellPanel(
shiny::div(
module_ui(id = "test_object"),
id = inner_module_id
),
Expand Down
Binary file modified tests/testthat/_snaps/mac/shiny2screenshot/counter.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 3 additions & 3 deletions tests/testthat/_snaps/module2app.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<h3>Evaluated</h3>
<pre class="shiny-text-output noplaceholder" id="inputs-eval"></pre>
<h2>Module UI</h2>
<div class="well" id="crow-module2app-module-ui">
<div id="crow-module2app-module-ui">
<div class="bg-info">
<em>No ui function provided.</em>
</div>
Expand Down Expand Up @@ -42,7 +42,7 @@
<h3>Evaluated</h3>
<pre class="shiny-text-output noplaceholder" id="inputs-eval"></pre>
<h2>Module UI</h2>
<div class="well" id="crow-module2app-module-ui">
<div id="crow-module2app-module-ui">
<button id="test_object-button" type="button" class="btn btn-default action-button">Counter</button>
<pre class="shiny-text-output noplaceholder" id="test_object-out"></pre>
</div>
Expand Down Expand Up @@ -85,7 +85,7 @@
<h3>Evaluated</h3>
<pre class="shiny-text-output noplaceholder" id="inputs-eval"></pre>
<h2>Module UI</h2>
<div class="well" id="crow-module2app-module-ui">
<div id="crow-module2app-module-ui">
<button id="test_object-button" type="button" class="btn btn-default action-button">Counter</button>
<pre class="shiny-text-output noplaceholder" id="test_object-out"></pre>
</div>
Expand Down
2 changes: 1 addition & 1 deletion tests/testthat/test-module2app.R
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ test_that("works with bs5", {
)
)
})
correct_attr <- list(selector = paste0("#", inner_module_id))
correct_attr <- list(selector = paste0("#", inner_module_id, " > *"))
test_that("returns attribute with dom selector", {
expect_equal(
attr(module2app(counter_button_ui), "crow_screenshot_args"),
Expand Down

0 comments on commit 4c38fa7

Please sign in to comment.