Skip to content

Commit

Permalink
test: check rows and columns deletion
Browse files Browse the repository at this point in the history
  • Loading branch information
davidgohel committed Jan 18, 2024
1 parent 329fbb2 commit 3228c9d
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions tests/testthat/test-cell-content.R
Original file line number Diff line number Diff line change
Expand Up @@ -129,3 +129,25 @@ test_that("append and prepend chunks structure", {
)
)
})

test_that("delete rows and columns", {
ftab <- flextable(head(iris))
ftab <- delete_columns(ftab, j = 1:3)
ftab <- delete_rows(ftab, i = 1:5, part = "body")
ftab <- autofit(ftab)


expect_equal(flextable:::fortify_run(ftab)$txt,
expected = c("Petal.Width", "Species", "0.4", "setosa")
)
expect_equal(ftab$col_keys,
expected = c("Petal.Width", "Species")
)
expect_equal(ftab$body$content$nrow,
expected = 1L
)
expect_equal(ftab$body$content$ncol,
expected = 2L
)

})

0 comments on commit 3228c9d

Please sign in to comment.