Skip to content

Commit

Permalink
add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Friessn committed Sep 23, 2024
1 parent c3c7ae9 commit 9bb6e84
Showing 1 changed file with 34 additions and 1 deletion.
35 changes: 34 additions & 1 deletion tests/testthat/test-editor.R
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ test_that("set editor input", {
editor = "input",
editorParams = list(
search = TRUE,
mask = "AAA-999",
mask = "",
selectContents = TRUE,
elementAttributes = list(
maxlength = 10
Expand All @@ -27,3 +27,36 @@ test_that("set editor input", {
expect_s3_class(t, "rtabulator")
expect_s3_class(t, "htmlwidget")
})

test_that("set editor area input", {
# Prepare
col = "input_var"
df <- data.frame(input_var = c("a","b","c"))


# Act
t <- tabulator(df) |>
set_column_editor_text_area(col)

# Assert
expected_column_def <- list(
title = "input_var",
field = "input_var",
hozAlign = "left",
editor = "textarea",
editorParams = list(
elementAttributes = list(
maxlength = 10
),
mask = "",
selectContents = TRUE,
verticalNavigation = "editor",
shiftEnterSubmit = TRUE
)
)
expect_mapequal(t$x$options$columns[[1]], expected_column_def)
expect_s3_class(t, "rtabulator")
expect_s3_class(t, "htmlwidget")
})


0 comments on commit 9bb6e84

Please sign in to comment.