Skip to content

Commit

Permalink
test f7Chip
Browse files Browse the repository at this point in the history
  • Loading branch information
DivadNojnarg committed Mar 15, 2024
1 parent b4affa8 commit cae108a
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 4 deletions.
1 change: 1 addition & 0 deletions R/f7Button.R
Original file line number Diff line number Diff line change
Expand Up @@ -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
#'
Expand Down
13 changes: 11 additions & 2 deletions R/f7Page.R
Original file line number Diff line number Diff line change
Expand Up @@ -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")
#' ),
Expand Down
2 changes: 2 additions & 0 deletions man/button.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 11 additions & 2 deletions man/f7SplitLayout.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 16 additions & 0 deletions tests/testthat/test-f7Chip.R
Original file line number Diff line number Diff line change
@@ -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")
})

0 comments on commit cae108a

Please sign in to comment.