From 82b95665fb0da5b7b554b4ac4843c30fff092608 Mon Sep 17 00:00:00 2001 From: Jake Tufts <137207796+JT-39@users.noreply.github.com> Date: Mon, 30 Dec 2024 12:16:45 +0000 Subject: [PATCH 1/3] Fix: Changed inputID to inputId in cookies_banner_server(), also ProjectId auto added to .Rproj - not sure if wanted (#77) --- R/cookies.R | 2 +- dfeshiny.Rproj | 45 +++++++++++++++++++++++---------------------- 2 files changed, 24 insertions(+), 23 deletions(-) diff --git a/R/cookies.R b/R/cookies.R index 4225b75..be83fa5 100644 --- a/R/cookies.R +++ b/R/cookies.R @@ -233,7 +233,7 @@ cookies_banner_server <- function( # updateTabsetPanel to have a cookie page for instance shiny::updateTabsetPanel( session = parent_session, - inputID = cookies_nav_id, + inputId = cookies_nav_id, selected = cookies_link_panel ) }) diff --git a/dfeshiny.Rproj b/dfeshiny.Rproj index 69fafd4..0af6124 100644 --- a/dfeshiny.Rproj +++ b/dfeshiny.Rproj @@ -1,22 +1,23 @@ -Version: 1.0 - -RestoreWorkspace: No -SaveWorkspace: No -AlwaysSaveHistory: Default - -EnableCodeIndexing: Yes -UseSpacesForTab: Yes -NumSpacesForTab: 2 -Encoding: UTF-8 - -RnwWeave: Sweave -LaTeX: pdfLaTeX - -AutoAppendNewline: Yes -StripTrailingWhitespace: Yes -LineEndingConversion: Posix - -BuildType: Package -PackageUseDevtools: Yes -PackageInstallArgs: --no-multiarch --with-keep.source -PackageRoxygenize: rd,collate,namespace +Version: 1.0 +ProjectId: 542ddaed-ab53-4f0c-8930-7994a4453a0d + +RestoreWorkspace: No +SaveWorkspace: No +AlwaysSaveHistory: Default + +EnableCodeIndexing: Yes +UseSpacesForTab: Yes +NumSpacesForTab: 2 +Encoding: UTF-8 + +RnwWeave: Sweave +LaTeX: pdfLaTeX + +AutoAppendNewline: Yes +StripTrailingWhitespace: Yes +LineEndingConversion: Posix + +BuildType: Package +PackageUseDevtools: Yes +PackageInstallArgs: --no-multiarch --with-keep.source +PackageRoxygenize: rd,collate,namespace From 0b7bb67faa02e940d214b56a7c6ad3b9e9480dc6 Mon Sep 17 00:00:00 2001 From: Cam Race <52536248+cjrace@users.noreply.github.com> Date: Thu, 2 Jan 2025 11:44:57 +0000 Subject: [PATCH 2/3] add UI test for cookies information link (#78) * add UI test for cookies information link * update test snapshots * stop lintr flagging commented out code issue * sometimes lintr really does do your nut in --- .../UI-02-cookies/cookies_consent-001.json | 10 +++--- .../UI-02-cookies/cookies_consent-002.json | 10 +++--- .../UI-02-cookies/cookies_consent-003.json | 10 +++--- .../UI-02-cookies/cookies_consent-004.json | 10 +++--- .../UI-02-cookies/cookies_consent-005.json | 19 ++++++++++ .../tests/testthat/test-UI-02-cookies.R | 35 ++++++++++--------- 6 files changed, 57 insertions(+), 37 deletions(-) create mode 100644 tests/test_dashboard/tests/testthat/_snaps/UI-02-cookies/cookies_consent-005.json diff --git a/tests/test_dashboard/tests/testthat/_snaps/UI-02-cookies/cookies_consent-001.json b/tests/test_dashboard/tests/testthat/_snaps/UI-02-cookies/cookies_consent-001.json index 4a10e92..54024cd 100644 --- a/tests/test_dashboard/tests/testthat/_snaps/UI-02-cookies/cookies_consent-001.json +++ b/tests/test_dashboard/tests/testthat/_snaps/UI-02-cookies/cookies_consent-001.json @@ -1,14 +1,14 @@ { "input": { "cookies": { - "dfe_analytics": "granted" + }, - "cookies_banner-cookies_accept": 1, - "cookies_banner-cookies_link": 0, + "cookies_banner-cookies_accept": 0, + "cookies_banner-cookies_link": 1, "cookies_banner-cookies_reject": 0, - "cookies_panel-cookies_analytics": "yes", + "cookies_panel-cookies_analytics": "no", "cookies_panel-submit_btn": 0, - "navlistPanel": "support_panel" + "navlistPanel": "cookies_panel_ui" }, "output": { diff --git a/tests/test_dashboard/tests/testthat/_snaps/UI-02-cookies/cookies_consent-002.json b/tests/test_dashboard/tests/testthat/_snaps/UI-02-cookies/cookies_consent-002.json index 59f3493..aff6a6a 100644 --- a/tests/test_dashboard/tests/testthat/_snaps/UI-02-cookies/cookies_consent-002.json +++ b/tests/test_dashboard/tests/testthat/_snaps/UI-02-cookies/cookies_consent-002.json @@ -1,14 +1,14 @@ { "input": { "cookies": { - "dfe_analytics": "denied" + "dfe_analytics": "granted" }, "cookies_banner-cookies_accept": 1, - "cookies_banner-cookies_link": 0, - "cookies_banner-cookies_reject": 1, - "cookies_panel-cookies_analytics": "no", + "cookies_banner-cookies_link": 1, + "cookies_banner-cookies_reject": 0, + "cookies_panel-cookies_analytics": "yes", "cookies_panel-submit_btn": 0, - "navlistPanel": "support_panel" + "navlistPanel": "cookies_panel_ui" }, "output": { diff --git a/tests/test_dashboard/tests/testthat/_snaps/UI-02-cookies/cookies_consent-003.json b/tests/test_dashboard/tests/testthat/_snaps/UI-02-cookies/cookies_consent-003.json index 8b97e70..74d194f 100644 --- a/tests/test_dashboard/tests/testthat/_snaps/UI-02-cookies/cookies_consent-003.json +++ b/tests/test_dashboard/tests/testthat/_snaps/UI-02-cookies/cookies_consent-003.json @@ -1,14 +1,14 @@ { "input": { "cookies": { - "dfe_analytics": "granted" + "dfe_analytics": "denied" }, "cookies_banner-cookies_accept": 1, - "cookies_banner-cookies_link": 0, + "cookies_banner-cookies_link": 1, "cookies_banner-cookies_reject": 1, - "cookies_panel-cookies_analytics": "yes", - "cookies_panel-submit_btn": 1, - "navlistPanel": "support_panel" + "cookies_panel-cookies_analytics": "no", + "cookies_panel-submit_btn": 0, + "navlistPanel": "cookies_panel_ui" }, "output": { diff --git a/tests/test_dashboard/tests/testthat/_snaps/UI-02-cookies/cookies_consent-004.json b/tests/test_dashboard/tests/testthat/_snaps/UI-02-cookies/cookies_consent-004.json index 015edf3..68b374f 100644 --- a/tests/test_dashboard/tests/testthat/_snaps/UI-02-cookies/cookies_consent-004.json +++ b/tests/test_dashboard/tests/testthat/_snaps/UI-02-cookies/cookies_consent-004.json @@ -1,14 +1,14 @@ { "input": { "cookies": { - "dfe_analytics": "denied" + "dfe_analytics": "granted" }, "cookies_banner-cookies_accept": 1, - "cookies_banner-cookies_link": 0, + "cookies_banner-cookies_link": 1, "cookies_banner-cookies_reject": 1, - "cookies_panel-cookies_analytics": "no", - "cookies_panel-submit_btn": 2, - "navlistPanel": "support_panel" + "cookies_panel-cookies_analytics": "yes", + "cookies_panel-submit_btn": 1, + "navlistPanel": "cookies_panel_ui" }, "output": { diff --git a/tests/test_dashboard/tests/testthat/_snaps/UI-02-cookies/cookies_consent-005.json b/tests/test_dashboard/tests/testthat/_snaps/UI-02-cookies/cookies_consent-005.json new file mode 100644 index 0000000..de64ca9 --- /dev/null +++ b/tests/test_dashboard/tests/testthat/_snaps/UI-02-cookies/cookies_consent-005.json @@ -0,0 +1,19 @@ +{ + "input": { + "cookies": { + "dfe_analytics": "denied" + }, + "cookies_banner-cookies_accept": 1, + "cookies_banner-cookies_link": 1, + "cookies_banner-cookies_reject": 1, + "cookies_panel-cookies_analytics": "no", + "cookies_panel-submit_btn": 2, + "navlistPanel": "cookies_panel_ui" + }, + "output": { + + }, + "export": { + + } +} diff --git a/tests/test_dashboard/tests/testthat/test-UI-02-cookies.R b/tests/test_dashboard/tests/testthat/test-UI-02-cookies.R index c77ac83..f5df5a7 100644 --- a/tests/test_dashboard/tests/testthat/test-UI-02-cookies.R +++ b/tests/test_dashboard/tests/testthat/test-UI-02-cookies.R @@ -1,5 +1,5 @@ # To run the diffviewer on these tests, you need to add the path: -# Doesn't work? testthat::snapshot_review('UI-02-cookies/', path='tests/test_dashboard/') +# like this! testthat::snapshot_review('UI-02-cookies/', path='tests/test_dashboard/tests/testthat') app <- AppDriver$new( name = "cookies_consent", expect_values_screenshot_args = FALSE @@ -7,36 +7,37 @@ app <- AppDriver$new( app$wait_for_idle(50) -app$click("cookies_banner-cookies_accept") -app$wait_for_idle(50) +test_that("Can click view cookie information", { + app$click("cookies_banner-cookies_link") + app$wait_for_idle(50) + app$expect_values() +}) test_that("Cookies accepted banner", { + app$click("cookies_banner-cookies_accept") + app$wait_for_idle(50) app$expect_values() }) -app$click("cookies_banner-cookies_reject") -app$wait_for_idle(50) test_that("Cookies rejected banner", { + app$click("cookies_banner-cookies_reject") + app$wait_for_idle(50) app$expect_values() }) -app$set_inputs(`cookies_panel-cookies_analytics` = "yes") -app$wait_for_idle(50) - -app$click("cookies_panel-submit_btn") -app$wait_for_idle(50) - test_that("Cookies accepted page", { + app$set_inputs(`cookies_panel-cookies_analytics` = "yes") + app$wait_for_idle(50) + app$click("cookies_panel-submit_btn") + app$wait_for_idle(50) app$expect_values() }) -app$set_inputs(`cookies_panel-cookies_analytics` = "no") -app$wait_for_idle(50) - -app$click("cookies_panel-submit_btn") -app$wait_for_idle(50) - test_that("Cookies rejected page", { + app$set_inputs(`cookies_panel-cookies_analytics` = "no") + app$wait_for_idle(50) + app$click("cookies_panel-submit_btn") + app$wait_for_idle(50) app$expect_values() }) From 10839ea6942570856e726072b50c188ef5de684e Mon Sep 17 00:00:00 2001 From: Cam Race <52536248+cjrace@users.noreply.github.com> Date: Thu, 2 Jan 2025 12:59:44 +0000 Subject: [PATCH 3/3] Increment version number to 0.5.3.9000 (#82) --- DESCRIPTION | 2 +- NEWS.md | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/DESCRIPTION b/DESCRIPTION index 8e8724c..4f22cb5 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: dfeshiny Title: DfE R Shiny Standards -Version: 0.5.3 +Version: 0.5.3.9000 Authors@R: c( person("Rich", "Bielby", , "richard.bielby@education.gov.uk", role = c("aut", "cre"), comment = c(ORCID = "0000-0001-9070-9969")), diff --git a/NEWS.md b/NEWS.md index f5e0b64..d7b692d 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,3 +1,9 @@ +# dfeshiny (development version) + +* Added extra flexibility to custom disconnect message in contact details and refresh link +* Relaxed arguments in cookies banner so different IDs can be used for navigation panel +* Fixed bug with inputId in the cookies banner + # dfeshiny 0.5.3 * Added `dfeshiny::a11y_panel()` to create model accessibility statement with custom