Skip to content

Commit ffdd7cf

Browse files
authored
Merge branch 'main' into fix-demo-url
2 parents 815e784 + c5d197b commit ffdd7cf

File tree

2 files changed

+23
-26
lines changed

2 files changed

+23
-26
lines changed

tests/testthat/helper.R

Lines changed: 20 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -4,27 +4,25 @@ extract_content <- function(html_tag, selector) {
44

55
test_app <- function() {
66
shiny::shinyApp(
7-
ui =
8-
shiny::fluidPage(
9-
use_empty_state(),
10-
shiny::actionButton("show", "Show empty state!"),
11-
shiny::actionButton("hide", "Hide empty state!"),
12-
shiny::tableOutput("my_table")
13-
),
14-
server =
15-
function(input, output) {
16-
empty_state_content <- htmltools::div(class = "myDiv")
17-
empty_state_manager <-
18-
EmptyStateManager$new(
19-
id = "my_table",
20-
html_content = empty_state_content)
21-
shiny::observeEvent(input$show, {
22-
empty_state_manager$show()
23-
})
24-
shiny::observeEvent(input$hide, {
25-
empty_state_manager$hide()
26-
})
27-
output$my_table <- shiny::renderTable(data.frame(NA))
28-
}
7+
ui = shiny::fluidPage(
8+
use_empty_state(),
9+
shiny::actionButton("show", "Show empty state!"),
10+
shiny::actionButton("hide", "Hide empty state!"),
11+
shiny::tableOutput("my_table")
12+
),
13+
server = function(input, output) {
14+
empty_state_content <- htmltools::div(class = "myDiv")
15+
empty_state_manager <- EmptyStateManager$new(
16+
id = "my_table",
17+
html_content = empty_state_content
18+
)
19+
shiny::observeEvent(input$show, {
20+
empty_state_manager$show()
21+
})
22+
shiny::observeEvent(input$hide, {
23+
empty_state_manager$hide()
24+
})
25+
output$my_table <- shiny::renderTable(data.frame(NA))
26+
}
2927
)
3028
}

tests/testthat/test-empty_state.R

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ describe("EmptyStateManager", {
1515
expect_equal(
1616
test_class$.__enclos_env__$private$.html_content,
1717
as.character(default_empty_state_component())
18-
)
18+
)
1919
})
2020

2121
it("should contain passed color", {
@@ -39,7 +39,7 @@ describe("EmptyStateManager", {
3939
expect_equal(
4040
app$get_html(selector = ".empty-state-content"),
4141
as.character(expected_div)
42-
)
42+
)
4343
app$stop()
4444
})
4545

@@ -56,15 +56,14 @@ describe("EmptyStateManager", {
5656
expect_null(app$get_html(selector = ".empty-state-content"))
5757
app$stop()
5858
})
59-
6059
})
6160

6261
describe("use_empty_state()", {
6362
test_func <- use_empty_state()
6463
src_files <- list(
6564
"emptystate.css",
6665
"emptystate.js"
67-
)
66+
)
6867

6968
it("should add source files properly", {
7069
expect <- paste0(

0 commit comments

Comments
 (0)