tests/testthat/test-is-dynamic.r

context("is.dynamic")
library(shiny)

test_that("regular plot is not dynamic", {
  p <- mtcars %>% ggvis(x = ~wt, y = ~cyl) %>% layer_points()
  expect_false(is.dynamic(p))
})

test_that("plot with reactive data source is dynamic", {
  p <- shiny::reactive(mtcars) %>% ggvis(x = ~wt, y = ~cyl) %>% layer_points()
  expect_true(is.dynamic(p))
})

test_that("plot with reactive transform param is dynamic", {
  p <- mtcars %>% ggvis(~mpg, ~wt) %>% layer_smooths(span = input_slider(0, 1))
  expect_true(is.dynamic(p))
})

Try the ggvis package in your browser

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

ggvis documentation built on May 29, 2024, 1:12 a.m.