test_that("Number UI is generated and working correctly", {
testthat::expect_equal(class(number_ui), "function")
testthat::expect_s3_class(number_ui("test"), "shiny.tag")
})
# See ?testServer for more information
test_that("Number Server is generated and working correctly", {
shiny::testServer(number_server, {
# Set initial value of a button
cat("Initially, number input is NULL, right?",
is.null(input$number),
"\n")
session$setInputs(number = 1)
cat("Just set the value of the select to 1? ",
input$number == 1,
"\n")
expect_equal(input$number, 1)
expect_equal(class(input$number),"numeric")
session$setInputs(number = "Text")
expect_warning(as.numeric(input$number))
})
})
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.