From cae108acdd888945388286b522c8ba52715dc114 Mon Sep 17 00:00:00 2001 From: DivadNojnarg Date: Fri, 15 Mar 2024 23:02:18 +0100 Subject: [PATCH] test f7Chip --- R/f7Button.R | 1 + R/f7Page.R | 13 +++++++++++-- man/button.Rd | 2 ++ man/f7SplitLayout.Rd | 13 +++++++++++-- tests/testthat/test-f7Chip.R | 16 ++++++++++++++++ 5 files changed, 41 insertions(+), 4 deletions(-) create mode 100644 tests/testthat/test-f7Chip.R diff --git a/R/f7Button.R b/R/f7Button.R index 858870ed..8ad26605 100644 --- a/R/f7Button.R +++ b/R/f7Button.R @@ -98,6 +98,7 @@ updateF7Button <- function(inputId, label = NULL, color = NULL, #' @param container `r lifecycle::badge("deprecated")`: #' removed from Framework7. #' @inheritParams f7Button +#' @inheritParams f7Block #' #' @rdname button #' diff --git a/R/f7Page.R b/R/f7Page.R index 1c369f00..e9aa2991 100644 --- a/R/f7Page.R +++ b/R/f7Page.R @@ -486,8 +486,17 @@ f7TabLayout <- function(..., navbar, messagebar = NULL, panels = NULL) { #' theme = "dark", #' f7PanelMenu( #' id = "menu", -#' f7PanelItem(tabName = "tab1", title = "Tab 1", icon = f7Icon("envelope"), active = TRUE), -#' f7PanelItem(tabName = "tab2", title = "Tab 2", icon = f7Icon("house")) +#' f7PanelItem( +#' tabName = "tab1", +#' title = "Tab 1", +#' icon = f7Icon("envelope"), +#' active = TRUE +#' ), +#' f7PanelItem( +#' tabName = "tab2", +#' title = "Tab 2", +#' icon = f7Icon("house") +#' ) #' ), #' uiOutput("selected_tab") #' ), diff --git a/man/button.Rd b/man/button.Rd index 473a1ff4..fcfb46b4 100644 --- a/man/button.Rd +++ b/man/button.Rd @@ -73,6 +73,8 @@ used in \link{f7Segment} with the strong parameter set to TRUE.} \item{container}{\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#deprecated}{\figure{lifecycle-deprecated.svg}{options: alt='[Deprecated]'}}}{\strong{[Deprecated]}}: removed from Framework7.} + +\item{strong}{Add white background so that text is highlighted. FALSE by default.} } \description{ \code{f7Button} generates a Framework7 action button. diff --git a/man/f7SplitLayout.Rd b/man/f7SplitLayout.Rd index 7f2c2045..52b0bbcb 100644 --- a/man/f7SplitLayout.Rd +++ b/man/f7SplitLayout.Rd @@ -38,8 +38,17 @@ if (interactive()) { theme = "dark", f7PanelMenu( id = "menu", - f7PanelItem(tabName = "tab1", title = "Tab 1", icon = f7Icon("envelope"), active = TRUE), - f7PanelItem(tabName = "tab2", title = "Tab 2", icon = f7Icon("house")) + f7PanelItem( + tabName = "tab1", + title = "Tab 1", + icon = f7Icon("envelope"), + active = TRUE + ), + f7PanelItem( + tabName = "tab2", + title = "Tab 2", + icon = f7Icon("house") + ) ), uiOutput("selected_tab") ), diff --git a/tests/testthat/test-f7Chip.R b/tests/testthat/test-f7Chip.R new file mode 100644 index 00000000..f175877e --- /dev/null +++ b/tests/testthat/test-f7Chip.R @@ -0,0 +1,16 @@ +test_that("chip works", { + expect_s3_class(f7Chip(), "shiny.tag") + expect_identical(f7Chip()$attribs$class, "chip") + expect_identical( + f7Chip(status = "green", outline = TRUE)$attribs$class, + "chip chip-outline color-green" + ) + + # With icon + chip_children <- dropNulls( + f7Chip(icon = f7Icon("plus_circle_fill"), iconStatus = "pink")$children + ) + expect_length(chip_children, 2) + expect_identical(chip_children[[1]]$attribs$class, "chip-media bg-color-pink") + expect_identical(chip_children[[2]]$attribs$class, "chip-label") +})