Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Example) Shinytest2 vs module #6

Open
wants to merge 9 commits into
base: main
Choose a base branch
from
3 changes: 3 additions & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,6 @@ $run_dev.*
^unstats\.Rproj$
^README\.Rmd$
^LICENSE\.md$
_\.new\.png$
^app\.R$
^rsconnect$
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,5 @@ po/*~

# RStudio Connect folder
rsconnect/
# {shinytest2}: Ignore new debug snapshots for `$expect_values()`
*_.new.png
4 changes: 3 additions & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ LazyData: true
RoxygenNote: 7.2.3
Suggests:
janitor,
readr
pkgload,
readr,
shinytest2
Depends:
R (>= 2.10)
3 changes: 3 additions & 0 deletions R/_disable_autoload.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Disabling shiny autoload

# See ?shiny::loadSupport for more information
7 changes: 7 additions & 0 deletions app.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Launch the ShinyApp (Do not remove this comment)
# To deploy, run: rsconnect::deployApp()
# Or use the blue button on top of this file

pkgload::load_all(export_all = FALSE, helpers = FALSE, attach_testthat = FALSE)
options("golem.app.prod" = TRUE)
unstats::run_app() # add parameters here (if any)
1 change: 1 addition & 0 deletions tests/testthat.R
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
shinytest2::test_app()
169 changes: 169 additions & 0 deletions tests/testthat/_snaps/mod_table/table_formatting-001.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,169 @@
{
"input": {
"table-table_cell_clicked": {

},
"table-table_cells_selected": [

],
"table-table_columns_selected": null,
"table-table_rows_all": [
1,
2,
3
],
"table-table_rows_current": [
1,
2,
3
],
"table-table_rows_selected": null,
"table-table_search": "",
"table-table_state": {
"start": 0,
"length": 10,
"order": [

],
"search": {
"search": "",
"smart": true,
"regex": false,
"caseInsensitive": true
},
"columns": [
{
"visible": true,
"search": {
"search": "",
"smart": true,
"regex": false,
"caseInsensitive": true
}
},
{
"visible": true,
"search": {
"search": "",
"smart": true,
"regex": false,
"caseInsensitive": true
}
},
{
"visible": true,
"search": {
"search": "",
"smart": true,
"regex": false,
"caseInsensitive": true
}
},
{
"visible": true,
"search": {
"search": "",
"smart": true,
"regex": false,
"caseInsensitive": true
}
}
]
}
},
"output": {
"table-table": {
"x": {
"filter": "none",
"vertical": false,
"container": "<table class=\"display\">\n <thead>\n <tr>\n <th> <\/th>\n <th>country<\/th>\n <th>X<\/th>\n <th>Y<\/th>\n <\/tr>\n <\/thead>\n<\/table>",
"options": {
"columnDefs": [
{
"className": "dt-right",
"targets": [
2,
3
]
},
{
"orderable": false,
"targets": 0
}
],
"order": [

],
"autoWidth": false,
"orderClasses": false,
"ajax": {
"type": "POST",
"data": "function(d) {\nd.search.caseInsensitive = true;\nd.search.smart = true;\nd.escape = true;\nvar encodeAmp = function(x) { x.value = x.value.replace(/&/g, \"%26\"); }\nencodeAmp(d.search);\n$.each(d.columns, function(i, v) {encodeAmp(v.search);});\n}"
},
"serverSide": true,
"processing": true
},
"selection": {
"mode": "multiple",
"selected": null,
"target": "row",
"selectable": null
}
},
"evals": [
"options.ajax.data"
],
"jsHooks": [

],
"deps": [
{
"name": "jquery",
"version": "3.6.0",
"src": {
"href": "jquery-3.6.0"
},
"meta": null,
"script": "jquery-3.6.0.min.js",
"stylesheet": null,
"head": null,
"attachment": null,
"all_files": true
},
{
"name": "dt-core",
"version": "1.13.4",
"src": {
"href": "dt-core-1.13.4"
},
"meta": null,
"script": "js/jquery.dataTables.min.js",
"stylesheet": [
"css/jquery.dataTables.min.css",
"css/jquery.dataTables.extra.css"
],
"head": null,
"attachment": null,
"package": null,
"all_files": false
},
{
"name": "crosstalk",
"version": "1.2.0",
"src": {
"href": "crosstalk-1.2.0"
},
"meta": null,
"script": "js/crosstalk.min.js",
"stylesheet": "css/crosstalk.min.css",
"head": null,
"attachment": null,
"all_files": true
}
]
}
},
"export": {

}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading