48 lines
4.2 KiB
R
48 lines
4.2 KiB
R
test_that("maximum length password input", {
|
|
x <- shiny::passwordInput("input_id", "Some password input")
|
|
y <- "<div class=\"form-group shiny-input-container\">\n <label class=\"control-label\" id=\"input_id-label\" for=\"input_id\">Some password input</label>\n <input id=\"input_id\" type=\"password\" class=\"shiny-input-password form-control\" value=\"\" data-update-on=\"change\" maxlength=\"50\"/>\n</div>"
|
|
expect_equal(as.character(htmlSetMaxLength(x, 50)), y)
|
|
})
|
|
test_that("minimum length password input", {
|
|
x <- shiny::passwordInput("input_id", "Some password input")
|
|
y <- "<div class=\"form-group shiny-input-container\">\n <label class=\"control-label\" id=\"input_id-label\" for=\"input_id\">Some password input</label>\n <input id=\"input_id\" type=\"password\" class=\"shiny-input-password form-control\" value=\"\" data-update-on=\"change\" minlength=\"3\"/>\n</div>"
|
|
expect_equal(as.character(htmlSetMinLength(x, 3)), y)
|
|
})
|
|
test_that("min/max length password input", {
|
|
x <- shiny::passwordInput("input_id", "Some password input")
|
|
y <- "<div class=\"form-group shiny-input-container\">\n <label class=\"control-label\" id=\"input_id-label\" for=\"input_id\">Some password input</label>\n <input id=\"input_id\" type=\"password\" class=\"shiny-input-password form-control\" value=\"\" data-update-on=\"change\" minlength=\"3\" maxlength=\"50\"/>\n</div>"
|
|
expect_equal(as.character(htmlSetMaxLength(htmlSetMinLength(x, 3), 50)), y)
|
|
})
|
|
|
|
test_that("maximum length text input", {
|
|
x <- shiny::textInput("input_id", "Some text input")
|
|
y <- "<div class=\"form-group shiny-input-container\">\n <label class=\"control-label\" id=\"input_id-label\" for=\"input_id\">Some text input</label>\n <input id=\"input_id\" type=\"text\" class=\"shiny-input-text form-control\" value=\"\" data-update-on=\"change\" maxlength=\"50\"/>\n</div>"
|
|
expect_equal(as.character(htmlSetMaxLength(x, 50)), y)
|
|
})
|
|
test_that("minimum length text input", {
|
|
x <- shiny::textInput("input_id", "Some text input")
|
|
y <- "<div class=\"form-group shiny-input-container\">\n <label class=\"control-label\" id=\"input_id-label\" for=\"input_id\">Some text input</label>\n <input id=\"input_id\" type=\"text\" class=\"shiny-input-text form-control\" value=\"\" data-update-on=\"change\" minlength=\"3\"/>\n</div>"
|
|
expect_equal(as.character(htmlSetMinLength(x, 3)), y)
|
|
})
|
|
test_that("min/max length text input", {
|
|
x <- shiny::textInput("input_id", "Some text input")
|
|
y <- "<div class=\"form-group shiny-input-container\">\n <label class=\"control-label\" id=\"input_id-label\" for=\"input_id\">Some text input</label>\n <input id=\"input_id\" type=\"text\" class=\"shiny-input-text form-control\" value=\"\" data-update-on=\"change\" minlength=\"3\" maxlength=\"50\"/>\n</div>"
|
|
expect_equal(as.character(htmlSetMaxLength(htmlSetMinLength(x, 3), 50)), y)
|
|
})
|
|
|
|
test_that("maximum length textarea input", {
|
|
x <- shiny::textAreaInput("input_id", "Some textarea input")
|
|
y <- "<div class=\"shiny-input-textarea form-group shiny-input-container\">\n <label class=\"control-label\" id=\"input_id-label\" for=\"input_id\">Some textarea input</label>\n <textarea id=\"input_id\" class=\"form-control\" data-update-on=\"change\" maxlength=\"500\"></textarea>\n</div>"
|
|
expect_equal(as.character(htmlSetMaxLength(x, 500)), y)
|
|
})
|
|
test_that("minimum length textarea input", {
|
|
x <- shiny::textAreaInput("input_id", "Some textarea input")
|
|
y <- "<div class=\"shiny-input-textarea form-group shiny-input-container\">\n <label class=\"control-label\" id=\"input_id-label\" for=\"input_id\">Some textarea input</label>\n <textarea id=\"input_id\" class=\"form-control\" data-update-on=\"change\" minlength=\"50\"></textarea>\n</div>"
|
|
expect_equal(as.character(htmlSetMinLength(x, 50)), y)
|
|
})
|
|
test_that("min/max length textarea input", {
|
|
x <- shiny::textAreaInput("input_id", "Some textarea input")
|
|
y <- "<div class=\"shiny-input-textarea form-group shiny-input-container\">\n <label class=\"control-label\" id=\"input_id-label\" for=\"input_id\">Some textarea input</label>\n <textarea id=\"input_id\" class=\"form-control\" data-update-on=\"change\" minlength=\"50\" maxlength=\"500\"></textarea>\n</div>"
|
|
expect_equal(as.character(htmlSetMaxLength(htmlSetMinLength(x, 50), 500)), y)
|
|
})
|