tests/testthat/test-arrowhead.R

test_that("arrowhead", {
  m <- leaflet() %>%
    addArrowhead(data = atlStorms2005, group = "groupname")
  expect_is(m, "leaflet")

  deps <- findDependencies(m)
  expect_equal(deps[[length(deps)]]$name, "lfx-arrowhead")
  expect_equal(m$x$calls[[length(m$x$calls)]]$method,
               "addArrowhead")
  expect_true(all(names(m$x$calls[[1]]$args[[10]]) %in%
                    c("yawn","size","frequency","proportionalToTotal")))

  m <- leaflet() %>% clearArrowhead("groupname")
  m$x$calls[[length(m$x$calls)]]$method == "clearArrowhead"
  m$x$calls[[length(m$x$calls)]]$args[[1]] == "groupname"

  m <- leaflet() %>% removeArrowhead(layerId = "layerid")
  m$x$calls[[length(m$x$calls)]]$method == "removeArrowhead"
  m$x$calls[[length(m$x$calls)]]$args[[1]] == "layerid"

  expect_error(leaflet() %>% clearArrowhead())
  expect_error(leaflet() %>% removeArrowhead())

})

Try the leaflet.extras2 package in your browser

Any scripts or data that you put into this service are public.

leaflet.extras2 documentation built on Aug. 21, 2023, 5:08 p.m.