Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitbecedd3

Browse files
committed
test: create helper.R and move test_app inside describe block
1 parent3485d92 commitbecedd3

File tree

2 files changed

+18
-18
lines changed

2 files changed

+18
-18
lines changed

‎tests/testthat/helper.R‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
init_driver<-function(app) {
2+
shinytest2::AppDriver$new(app)
3+
}

‎tests/testthat/test_dropdown.R‎

Lines changed: 15 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -18,29 +18,26 @@ test_that("test dropdown_input", {
1818
si_str,fixed=TRUE)))
1919
})
2020

21-
init_driver<-function(app) {
22-
shinytest2::AppDriver$new(app)
23-
}
24-
25-
test_app<-function(value,initial_value,multiple,choices=NULL,initial_choices=LETTERS) {
26-
type<-if (multiple)"multiple"else""
27-
shiny::shinyApp(
28-
ui= semanticPage(
29-
dropdown_input("dropdown",initial_choices,value=initial_value,type=type),
30-
shiny::actionButton("trigger","Trigger")
31-
),
32-
server=function(input,output,session) {
33-
shiny::observeEvent(input$trigger, {
34-
update_dropdown_input(session,"dropdown",value=value,choices=choices)
35-
})
36-
}
37-
)
38-
}
3921

4022
describe("update_dropdown_input", {
4123
skip_on_cran()
4224
local_edition(3)
4325

26+
test_app<-function(value,initial_value,multiple,choices=NULL,initial_choices=LETTERS) {
27+
type<-if (multiple)"multiple"else""
28+
shiny::shinyApp(
29+
ui= semanticPage(
30+
dropdown_input("dropdown",initial_choices,value=initial_value,type=type),
31+
shiny::actionButton("trigger","Trigger")
32+
),
33+
server=function(input,output,session) {
34+
shiny::observeEvent(input$trigger, {
35+
update_dropdown_input(session,"dropdown",value=value,choices=choices)
36+
})
37+
}
38+
)
39+
}
40+
4441
it("is a no-op with NULL value", {
4542
# Arrange
4643
initial_value<-"A"

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp