Skip to content

Commit

Permalink
Merge branch 'main' into 251_fix_observers_for_plot_resizing@main
Browse files Browse the repository at this point in the history
  • Loading branch information
donyunardi authored Aug 15, 2024
2 parents 54b3c5b + cc8faa9 commit af64388
Show file tree
Hide file tree
Showing 16 changed files with 42 additions and 53 deletions.
5 changes: 1 addition & 4 deletions .github/workflows/check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,8 @@ jobs:
NOT_CRAN=true
TESTING_DEPTH=5
enforce-note-blocklist: true
publish-unit-test-report-gh-pages: false
junit-xml-comparison: false
concurrency-group: non-cran
disable-unit-test-reports: true
skip-r-cmd-install: true
unit-test-report-directory: unit-test-report-non-cran
note-blocklist: |
checking dependencies in R code .* NOTE
checking R code for possible problems .* NOTE
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,4 @@ jobs:
REPO_GITHUB_TOKEN: ${{ secrets.REPO_GITHUB_TOKEN }}
with:
default-landing-page: latest-tag
additional-unit-test-report-directories: unit-test-report-non-cran
12 changes: 0 additions & 12 deletions .github/workflows/on-demand.yaml

This file was deleted.

4 changes: 4 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,7 @@ jobs:
uses: insightsengineering/r.pkg.template/.github/workflows/test-coverage.yaml@main
secrets:
REPO_GITHUB_TOKEN: ${{ secrets.REPO_GITHUB_TOKEN }}
wasm:
name: Build WASM packages 🧑‍🏭
needs: release
uses: insightsengineering/r.pkg.template/.github/workflows/wasm.yaml@main
7 changes: 7 additions & 0 deletions .github/workflows/scheduled.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,17 @@ jobs:
GCHAT_WEBHOOK: ${{ secrets.GCHAT_WEBHOOK }}
with:
strategy: ${{ matrix.test-strategy }}
extra-deps: "R.utils (>= 2.12.3)"
additional-env-vars: |
PKG_SYSREQS_DRY_RUN=true
branch-cleanup:
name: Branch Cleanup 🧹
uses: insightsengineering/r.pkg.template/.github/workflows/branch-cleanup.yaml@main
secrets:
REPO_GITHUB_TOKEN: ${{ secrets.REPO_GITHUB_TOKEN }}
revdepcheck:
name: revdepcheck ↩️
uses: insightsengineering/r.pkg.template/.github/workflows/revdepcheck.yaml@main
rhub:
name: R-hub 🌐
uses: insightsengineering/r.pkg.template/.github/workflows/rhub.yaml@main
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ default_language_version:
python: python3
repos:
- repo: https://github.com/lorenzwalthert/precommit
rev: v0.4.2
rev: v0.4.3
hooks:
- id: style-files
name: Style code with `styler`
Expand Down
6 changes: 3 additions & 3 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: teal.widgets
Title: 'shiny' Widgets for 'teal' Applications
Version: 0.4.2.9014
Date: 2024-07-10
Version: 0.4.2.9017
Date: 2024-08-06
Authors@R: c(
person("Dawid", "Kaledkowski", , "[email protected]", role = c("aut", "cre")),
person("Pawel", "Rucki", , "[email protected]", role = "aut"),
Expand Down Expand Up @@ -61,4 +61,4 @@ Encoding: UTF-8
Language: en-US
LazyData: true
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.3.1
RoxygenNote: 7.3.2
2 changes: 1 addition & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# teal.widgets 0.4.2.9014
# teal.widgets 0.4.2.9017

# teal.widgets 0.4.2

Expand Down
2 changes: 1 addition & 1 deletion R/plot_with_settings.R
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,7 @@ plot_with_settings_srv <- function(id,
})

output$width_warning <- renderUI({
grDevices::pdf(NULL) # reset Rplots.pdf for shiny server
grDevices::pdf(nullfile()) # reset Rplots.pdf for shiny server
w <- grDevices::dev.size("px")[1]
grDevices::dev.off()
if (p_width() < w) {
Expand Down
2 changes: 1 addition & 1 deletion R/table_with_settings.R
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ type_download_srv_table <- function(id, table_reactive) {
try(rtables::paginate_table(
tt = table_reactive(),
lpp = as.numeric(input$lpp)
))
), silent = TRUE)
}

if (inherits(catch_warning, "try-error")) {
Expand Down
2 changes: 2 additions & 0 deletions _pkgdown.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ navbar:
href: coverage-report/
- text: Unit test report
href: unit-test-report/
- text: Non-CRAN unit test report
href: unit-test-report-non-cran/
github:
icon: fa-github
href: https://github.com/insightsengineering/teal.widgets
Expand Down
1 change: 1 addition & 0 deletions tests/testthat/helpers-utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ is_draw <- function(plot_fun) {
checkmate::assert_function(plot_fun)
grDevices::graphics.off() # close any current graphics devices
cdev <- grDevices::dev.cur()
grDevices::pdf(nullfile())
plot_fun()
if (cdev != grDevices::dev.cur()) {
on.exit(grDevices::dev.off())
Expand Down
20 changes: 9 additions & 11 deletions tests/testthat/test-plot_with_settings.R
Original file line number Diff line number Diff line change
Expand Up @@ -75,17 +75,16 @@ plot_funs <- list(
function() boxplot(2),
function() 2
)
plot_types <- list(
function() "gg",
function() "trel",
function() "grob",
function() "base",
function() "base",
function() "other"
)

testthat::test_that("print_plot is able to plot different types of graphics", {
plot_types <- list(
function() "ANYTHING",
function() "trel",
function() "grob",
function() "base",
function() "base",
function() "other"
)

for (p in seq_along(plot_funs)) {
testthat::expect_true(
is_draw(function() print_plot(plot_funs[[p]], plot_types[[p]]))
Expand Down Expand Up @@ -484,14 +483,13 @@ testthat::test_that("plot_with_settings_srv returns the click ggplot2 functional
})

testthat::test_that("plot_with_settings_srv and plot_type reactive types", {
plot_types <- c("gg", "trel", "grob", "base", "base", "other")
for (p in seq_along(plot_funs)) {
plot_with_settings_args[["plot_r"]] <- plot_funs[[p]]
shiny::testServer(
teal.widgets:::plot_with_settings_srv,
args = plot_with_settings_args,
expr = {
testthat::expect_identical(plot_type(), plot_types[p])
plot_suppress(testthat::expect_identical(plot_type(), plot_types[[p]]()))
}
)
}
Expand Down
3 changes: 0 additions & 3 deletions tests/testthat/test-plot_with_settings_ui.R
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,6 @@ testthat::test_that(

app_driver$click(selector = "#plot_with_settings-downbutton-downl")
app_driver$wait_for_idle(timeout = default_idle_timeout)
app_driver$expect_download("plot_with_settings-downbutton-data_download")

filename <- app_driver$get_download("plot_with_settings-downbutton-data_download")
testthat::expect_match(filename, "png$", fixed = FALSE)
Expand Down Expand Up @@ -454,8 +453,6 @@ testthat::test_that("e2e teal.widgets::plot_with_settings: expanded image can be
app_driver$click(selector = "#plot_with_settings-modal_downbutton-downl")
app_driver$wait_for_idle(timeout = default_idle_timeout)

app_driver$expect_download("plot_with_settings-modal_downbutton-data_download")

filename <- app_driver$get_download("plot_with_settings-modal_downbutton-data_download")
testthat::expect_match(filename, "png$", fixed = FALSE)

Expand Down
23 changes: 10 additions & 13 deletions tests/testthat/test-table_with_settings.R
Original file line number Diff line number Diff line change
Expand Up @@ -110,20 +110,17 @@ testthat::test_that("type_download_srv_table: downloading different output types
})

testthat::test_that("type_download_srv_table: pagination, lpp to small", {
testthat::expect_error(
shiny::testServer(
teal.widgets:::type_download_srv_table,
args = list(id = "tws", table_reactive = table_r),
expr = {
for (down_type in c(".txt", ".pdf")) {
session$setInputs(`pagination_switch` = TRUE)
session$setInputs(`lpp` = 1)
session$setInputs(`file_format` = down_type)
testthat::expect_true(file.exists(output$data_download))
}
shiny::testServer(
teal.widgets:::type_download_srv_table,
args = list(id = "tws", table_reactive = table_r),
expr = {
for (down_type in c(".txt", ".pdf")) {
session$setInputs(`pagination_switch` = TRUE)
session$setInputs(`lpp` = 1)
session$setInputs(`file_format` = down_type)
testthat::expect_error(output$data_download, "Lines of repeated context")
}
),
"Lines of repeated context"
}
)
})

Expand Down
3 changes: 0 additions & 3 deletions tests/testthat/test-table_with_settings_ui.R
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,6 @@ testthat::test_that(

app_driver$click(selector = "#table_with_settings-downbutton-dwnl")
app_driver$wait_for_idle(timeout = default_idle_timeout)
app_driver$expect_download("table_with_settings-downbutton-data_download")

filename <- app_driver$get_download("table_with_settings-downbutton-data_download")
testthat::expect_match(filename, "txt$", fixed = FALSE)
Expand Down Expand Up @@ -371,8 +370,6 @@ testthat::test_that("e2e teal.widgets::table_with_settings: expanded table can b
app_driver$click(selector = "#table_with_settings-modal_downbutton-dwnl")
app_driver$wait_for_idle(timeout = default_idle_timeout)

app_driver$expect_download("table_with_settings-modal_downbutton-data_download")

filename <- app_driver$get_download("table_with_settings-modal_downbutton-data_download")
testthat::expect_match(filename, "txt$", fixed = FALSE)

Expand Down

0 comments on commit af64388

Please sign in to comment.